Better logging of printer callback errors

This commit is contained in:
Gina Häußge committed 2018-03-07 13:41:29 +01:00
1 parent 125673b846
commit 283c44e35e
1 file changed
+16 -8
+16 -8
View File
@@ -139,23 +139,31 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
def _sendAddTemperatureCallbacks(self, data):
for callback in self._callbacks:
try: callback.on_printer_add_temperature(data)
except: self._logger.exception("Exception while adding temperature data point")
try:
callback.on_printer_add_temperature(data)
except:
self._logger.exception(u"Exception while adding temperature data point to callback {}".format(callback))
def _sendAddLogCallbacks(self, data):
for callback in self._callbacks:
try: callback.on_printer_add_log(data)
except: self._logger.exception("Exception while adding communication log entry")
try:
callback.on_printer_add_log(data)
except:
self._logger.exception(u"Exception while adding communication log entry to callback {}".format(callback))
def _sendAddMessageCallbacks(self, data):
for callback in self._callbacks:
try: callback.on_printer_add_message(data)
except: self._logger.exception("Exception while adding printer message")
try:
callback.on_printer_add_message(data)
except:
self._logger.exception(u"Exception while adding printer message to callback {}".format(callback))
def _sendCurrentDataCallbacks(self, data):
for callback in self._callbacks:
try: callback.on_printer_send_current_data(copy.deepcopy(data))
except: self._logger.exception("Exception while pushing current data")
try:
callback.on_printer_send_current_data(copy.deepcopy(data))
except:
self._logger.exception(u"Exception while pushing current data to callback {}".format(callback))
#~~ callback from metadata analysis event