Raise exception when led update fails
This commit is contained in:
parent
d624b13560
commit
6d35129e23
@ -154,17 +154,18 @@ def measure(
|
||||
led_dev.set_level(new_led_val)
|
||||
led_val = new_led_val
|
||||
except Exception as e:
|
||||
log.error("Error setting led to {new_led_val}%: {e}")
|
||||
log.error(f"Error setting led to {new_led_val:03}%: {e}")
|
||||
raise e
|
||||
|
||||
except KeyboardInterrupt:
|
||||
log.info("Keyboard interrupt, stopping")
|
||||
log.info("Keyboard interrupt, stopping measurement")
|
||||
except Exception as e:
|
||||
log.critical(f"Unexpected error, stopping. Error: {e}")
|
||||
log.critical(f"Unexpected error, stopping measurement. Error: {e}")
|
||||
if add_measurement_info_to_metadata:
|
||||
data.metadata["measurement_time_stop"] = get_time()
|
||||
# Write again after having updated the stop time
|
||||
data.write_metadata()
|
||||
data.flush(verbose=verbose)
|
||||
data.flush()
|
||||
led_dev.off()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user