Browse Source

Release 46c53c04e2; Exception message added for response callbacks

master
Dirk Alders 4 years ago
parent
commit
da432a9340
3 changed files with 46523 additions and 46457 deletions
  1. 6
    3
      __init__.py
  2. 46517
    46454
      _testresults_/unittest.json
  3. BIN
      _testresults_/unittest.pdf

+ 6
- 3
__init__.py View File

475
                     status = STATUS_BUFFERING_UNHANDLED_REQUEST
475
                     status = STATUS_BUFFERING_UNHANDLED_REQUEST
476
                     data = None
476
                     data = None
477
                 else:
477
                 else:
478
+                    self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
478
                     try:
479
                     try:
479
-                        self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
480
                         status, data = callback(msg, *args, **kwargs)
480
                         status, data = callback(msg, *args, **kwargs)
481
                     except Exception as e:
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
                         status = STATUS_CALLBACK_ERROR
483
                         status = STATUS_CALLBACK_ERROR
484
                         data = None
484
                         data = None
485
             else:
485
             else:
490
                     self.__buffer_received_data__(msg)
490
                     self.__buffer_received_data__(msg)
491
                 else:
491
                 else:
492
                     self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
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
                 return  # No response needed
497
                 return  # No response needed
495
         self.send(self.__sid_response_dict__[msg.get_service_id()], msg.get_data_id(), data, status=status)
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
File diff suppressed because it is too large
View File


BIN
_testresults_/unittest.pdf View File


Loading…
Cancel
Save