mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Catch FileNotFoundError when updating custom firmware
In case there is a bug there, we won't crash the thread.
This commit is contained in:
parent
0655ef0bc5
commit
877d061a1b
1 changed files with 5 additions and 3 deletions
|
@ -127,9 +127,11 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
if self._connection_state != ConnectionState.closed:
|
if self._connection_state != ConnectionState.closed:
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
hex_file = intelHex.readHex(self._firmware_location)
|
try:
|
||||||
if len(hex_file) == 0:
|
hex_file = intelHex.readHex(self._firmware_location)
|
||||||
Logger.log("e", "Unable to read provided hex file. Could not update firmware")
|
assert len(hex_file) > 0
|
||||||
|
except (FileNotFoundError, AssertionError):
|
||||||
|
Logger.log("e", "Unable to read provided hex file. Could not update firmware.")
|
||||||
self.setFirmwareUpdateState(FirmwareUpdateState.firmware_not_found_error)
|
self.setFirmwareUpdateState(FirmwareUpdateState.firmware_not_found_error)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue