From 49a9561625b2b324d7efe2030b7794b3db448d5e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 8 Apr 2019 17:43:03 +0200 Subject: [PATCH] Added exception handling for serial write --- plugins/USBPrinting/USBPrinterOutputDevice.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index 667a969e87..6ce042f32d 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -226,6 +226,9 @@ class USBPrinterOutputDevice(PrinterOutputDevice): except SerialTimeoutException: Logger.log("w", "Timeout when sending command to printer via USB.") self._command_received.set() + except SerialException: + Logger.logException("w", "An unexpected exception occurred while writing to the serial.") + self.setConnectionState(ConnectionState.Error) def _update(self): while self._connection_state == ConnectionState.Connected and self._serial is not None: