Skip to content

Instantly share code, notes, and snippets.

@renestein
Forked from Lokutus/BarCodeException.cs
Created May 9, 2012 13:46
Show Gist options
  • Save renestein/2644604 to your computer and use it in GitHub Desktop.
Save renestein/2644604 to your computer and use it in GitHub Desktop.
using System;
public enum ErrorCodes
{
NotNumeric,
BadFormat,
ChecksumError
}
public class BarCodeException : ArgumentException
{
public ErrorCodes ErrorCode
{
get;
private set;
}
public BarCodeException()
: base()
{
}
public BarCodeException(string message)
: base(message)
{
}
public BarCodeException(string format, params object[] args)
: base(string.Format(format, args))
{
}
public BarCodeException(string message, Exception innerException)
: base(message, innerException)
{
}
public BarCodeException(string format, Exception innerException, params object[] args)
: base(string.Format(format, args), innerException)
{
}
protected BarCodeException(System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
public BarCodeException(ErrorCodes errorCode)
: this(String.Empty, errorCode)
{
}
public BarCodeException(string message, ErrorCodes errorCode)
: this(message)
{
ErrorCode = errorCode;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment