瀏覽代碼

Release 46c53c04e2; Exception message added for response callbacks

master
Dirk Alders 4 年之前
父節點
當前提交
da432a9340
共有 3 個檔案被更改,包括 46523 行新增46457 行删除
  1. 6
    3
      __init__.py
  2. 46517
    46454
      _testresults_/unittest.json
  3. 二進制
      _testresults_/unittest.pdf

+ 6
- 3
__init__.py 查看文件

@@ -475,11 +475,11 @@ class pure_json_protocol(object):
475 475
                     status = STATUS_BUFFERING_UNHANDLED_REQUEST
476 476
                     data = None
477 477
                 else:
478
+                    self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
478 479
                     try:
479
-                        self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
480 480
                         status, data = callback(msg, *args, **kwargs)
481 481
                     except Exception as e:
482
-                        logger.error('{lp} Exception raised. Check callback {callback_name}: "{message}" and it\'s return values for service_id  {service_id} and data_id {data_id}'.format(lp=self.__log_prefix__(), callback_name=callback.__name__, message=str(e), service_id=repr(msg.get_service_id()), data_id=repr(msg.get_data_id())))
482
+                        logger.error('{lp} Exception raised. Check callback {callback_name}: "{message}" and it\'s return values for {msg_info}'.format(lp=self.__log_prefix__(), callback_name=callback.__name__, message=str(e), msg_info=self.__get_message_name__(msg.get_service_id(), msg.get_data_id())))
483 483
                         status = STATUS_CALLBACK_ERROR
484 484
                         data = None
485 485
             else:
@@ -490,7 +490,10 @@ class pure_json_protocol(object):
490 490
                     self.__buffer_received_data__(msg)
491 491
                 else:
492 492
                     self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
493
-                    callback(msg, *args, **kwargs)
493
+                    try:
494
+                        callback(msg, *args, **kwargs)
495
+                    except Exception as e:
496
+                        logger.error('{lp} Exception raised. Check callback {callback_name}: "{message}" for {msg_info}'.format(lp=self.__log_prefix__(), callback_name=callback.__name__, message=str(e), msg_info=self.__get_message_name__(msg.get_service_id(), msg.get_data_id())))
494 497
                 return  # No response needed
495 498
         self.send(self.__sid_response_dict__[msg.get_service_id()], msg.get_data_id(), data, status=status)
496 499
 

+ 46517
- 46454
_testresults_/unittest.json
文件差異過大導致無法顯示
查看文件


二進制
_testresults_/unittest.pdf 查看文件


Loading…
取消
儲存