65 lines
1.9 KiB
C#
65 lines
1.9 KiB
C#
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;
|
|
}
|
|
}
|