out of paper detection
This commit is contained in:
@@ -42,7 +42,8 @@ public class EpsonPrintService: IPrintService
|
||||
var status = await epsonPrinter.GetPrinterStatusAsync();
|
||||
if (!status.IsOnline)
|
||||
{
|
||||
throw new InvalidOperationException("Printer is offline or out of paper.");
|
||||
_logger.LogWarning("Printer {PrinterIp} is out of paper", printerIp);
|
||||
return PrintResult.Fail(PrintErrorType.OutOfPaper);
|
||||
}
|
||||
var printerAdapter = _wrapperPrinterFactory.CreatePrinterFromId(printerId.Value, epsonPrinter);
|
||||
|
||||
@@ -101,11 +102,17 @@ public class EpsonPrintService: IPrintService
|
||||
status = await epsonPrinter.GetPrinterStatusAsync();
|
||||
if (!status.IsOnline)
|
||||
{
|
||||
throw new InvalidOperationException("Printer is offline or out of paper.");
|
||||
_logger.LogWarning("Printer {PrinterIp} is out of paper", printerIp);
|
||||
return PrintResult.Fail(PrintErrorType.OutOfPaper);
|
||||
}
|
||||
|
||||
await printerAdapter.Cut();
|
||||
}
|
||||
catch (EpsonConnectionException e)
|
||||
{
|
||||
_logger.LogWarning(e, "Printer {PrinterIp} is offline", printerIp);
|
||||
return PrintResult.Fail(PrintErrorType.Offline);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogWarning(e, "Failed to print job for printer {PrinterUid}", printerIp);
|
||||
|
||||
Reference in New Issue
Block a user