mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -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:
|
||||
self.close()
|
||||
|
||||
hex_file = intelHex.readHex(self._firmware_location)
|
||||
if len(hex_file) == 0:
|
||||
Logger.log("e", "Unable to read provided hex file. Could not update firmware")
|
||||
try:
|
||||
hex_file = intelHex.readHex(self._firmware_location)
|
||||
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)
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue