Add project files.
This commit is contained in:
64
Inspectron.Epson/EpsonExceptions.cs
Normal file
64
Inspectron.Epson/EpsonExceptions.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
namespace Inspectron.Epson;
|
||||
|
||||
/// <summary>
|
||||
/// Base exception for all Epson printer-related errors
|
||||
/// </summary>
|
||||
public class EpsonPrinterException : Exception
|
||||
{
|
||||
public EpsonPrinterException() { }
|
||||
public EpsonPrinterException(string message) : base(message) { }
|
||||
public EpsonPrinterException(string message, Exception innerException) : base(message, innerException) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when connection to the printer fails or is lost
|
||||
/// </summary>
|
||||
public class EpsonConnectionException : EpsonPrinterException
|
||||
{
|
||||
public string? PrinterIp { get; }
|
||||
public int? PrinterPort { get; }
|
||||
|
||||
public EpsonConnectionException() { }
|
||||
|
||||
public EpsonConnectionException(string message) : base(message) { }
|
||||
|
||||
public EpsonConnectionException(string message, Exception innerException) : base(message, innerException) { }
|
||||
|
||||
public EpsonConnectionException(string message, string printerIp, int printerPort) : base(message)
|
||||
{
|
||||
PrinterIp = printerIp;
|
||||
PrinterPort = printerPort;
|
||||
}
|
||||
|
||||
public EpsonConnectionException(string message, string printerIp, int printerPort, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
PrinterIp = printerIp;
|
||||
PrinterPort = printerPort;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when a command sent to the printer fails
|
||||
/// </summary>
|
||||
public class EpsonCommandException : EpsonPrinterException
|
||||
{
|
||||
public byte[]? Command { get; }
|
||||
|
||||
public EpsonCommandException() { }
|
||||
|
||||
public EpsonCommandException(string message) : base(message) { }
|
||||
|
||||
public EpsonCommandException(string message, Exception innerException) : base(message, innerException) { }
|
||||
|
||||
public EpsonCommandException(string message, byte[] command) : base(message)
|
||||
{
|
||||
Command = command;
|
||||
}
|
||||
|
||||
public EpsonCommandException(string message, byte[] command, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
Command = command;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user