Пример #1
0
 def handle_unknown_error(e):
     """
     未知的异常
     :param e:
     :return:
     """
     try:
         return render_info(info=MyResponse.init_error(e), template='errors/500.html')
     finally:
         # 记录日志
         current_app.logger.exception(e)
Пример #2
0
 def error_listener(self, event):
     """
     定时异常监听
     :type event: JobExecutionEvent
     :param event: 
     :return: 
     """
     res = MyResponse.init_error(event.exception)
     try:
         self.app.logger.exception(event.exception)
     finally:
         with self.app.app_context():
             # 发送异常报警信息
             WXMsg(msg_content=self._ERROR_MSG.format(
                 job_id=event.job_id, msg=res.msg)).send_wx()