def _on_exception(self, error_type, value, traceback, handler=None, fevent=None): s = [] if handler is None: handler = "" else: handler = reprhandler(handler) msg = "ERROR {0:s} ({1:s}) ({2:s}): {3:s}\n".format( handler, repr(fevent), repr(error_type), repr(value) ) s.append(msg) s.extend(traceback) s.append("\n") stderr.write("".join(s))
def _on_exception(self, error_type, value, traceback, handler=None, fevent=None): s = [] if handler is None: handler = "" else: handler = reprhandler(handler) msg = "ERROR {0:s} ({1:s}) ({2:s}): {3:s}\n".format( handler, repr(fevent), repr(error_type), repr(value) ) s.append(msg) s.append('Traceback (most recent call last):\n') s.extend(traceback) s.extend(format_exception_only(error_type, value)) s.append("\n") stderr.write("".join(s))
def _on_exception(self, error_type, value, traceback, handler=None, fevent=None): # TODO: Generate hashes and thus unique urls with exceptions and fill # them out with this data: # self.log('EXCEPTIONHANDLER:', error_type, value, traceback, lvl=critical) # The idea is to have error pages in the documentation/public Isomer instance # so people can discuss and get help on runtime errors, like with the # exitcodes system in the documentation try: s = [] if handler is None: handler = "" else: handler = reprhandler(handler) msg = "ERROR" msg += "{0:s} ({1:s}) ({2:s}): {3:s}\n".format( handler, repr(fevent), repr(error_type), repr(value) ) s.append(msg) s.append("\n") isolog("\n".join(s), "\n".join(traceback), lvl=critical, frame_ref=3, emitter="DEBUG") alert = { "component": "isomer.alert.manager", "action": "notify", "data": { "type": "danger", "message": "\n".join(s), "title": "Exception Monitor", }, } for user in self.config.notificationusers: self.fireEvent(send(None, alert, username=user, sendtype="user")) except Exception as e: self.log("Exception during exception handling: ", e, type(e), lvl=critical, exc=True)
def _on_exception(self, error_type, value, traceback, handler=None, fevent=None): try: s = [] if handler is None: handler = "" else: handler = reprhandler(handler) msg = "ERROR" msg += "{0:s} ({1:s}) ({2:s}): {3:s}\n".format( handler, repr(fevent), repr(error_type), repr(value)) s.append(msg) s.extend(traceback) s.append("\n") self.log("\n".join(s), lvl=critical) alert = { 'component': 'hfos.alert.manager', 'action': 'danger', 'data': { 'message': "\n".join(s), 'title': 'Exception Monitor' } } for user in self.config.notificationusers: self.fireEvent( send(None, alert, username=user, sendtype='user')) except Exception as e: self.log("Exception during exception handling: ", e, type(e), lvl=critical)
def _on_exception(self, error_type, value, traceback, handler=None, fevent=None): try: s = [] if handler is None: handler = "" else: handler = reprhandler(handler) msg = "ERROR" msg += "{0:s} ({1:s}) ({2:s}): {3:s}\n".format( handler, repr(fevent), repr(error_type), repr(value) ) s.append(msg) s.extend(traceback) s.append("\n") self.log("\n".join(s), lvl=critical) alert = { 'component': 'alert', 'action': 'danger', 'data': { 'message': "\n".join(s), 'title': 'Exception Monitor' } } for user in self.config.notificationusers: self.fireEvent(send(None, alert, username=user, sendtype='user')) except Exception as e: self.log("Exception during exception handling: ", e, type(e), lvl=critical)