Avoid degrading exceptions
Several exceptions are caught only to be degraded to a stripped down error. See for example the ClientProcess initialisation:
except Exception as err:
try:
self.queue_logging.put("ERROR: " + str(self.thread_num)
+ ": Uncaught exception in client process -> Kill process\n"
+ "Python-ERROR: " + str(err))
sleep(0.1) # sleep to flush to queue
except Exception as err:
print("logger fail!!!!!!\n" + "Python-ERROR: " + str(err))
exit(-1)
exit(-1)
Here, a generic Exception is caught; reporting degrades it to just the exception message, removing both type and traceback. Further errors are degraded to reporting the exception message on stdout. Finally, this is degraded to an error code (in an invalid range). In this case, any Exception caught has already been degraded to a SystemExit.
Exceptions should only be caught if they are handled - the Python runtime will exit correctly if an Exception is unhandled. If needed for logging, catch-log-raise the Exception to not swallow it.
except Exception:
self.logger.exception("Fatal Exception in NaviX ClientProcess")
raise
See also issue #11 to enable the standard logging capabilities.
Edited by Max Fischer