Parcourir la source

Release 46c53c04e2; Exception message added for response callbacks

master
Dirk Alders il y a 4 ans
Parent
révision
da432a9340
3 fichiers modifiés avec 46523 ajouts et 46457 suppressions
  1. 6
    3
      __init__.py
  2. 46517
    46454
      _testresults_/unittest.json
  3. BIN
      _testresults_/unittest.pdf

+ 6
- 3
__init__.py Voir le fichier

@@ -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
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


BIN
_testresults_/unittest.pdf Voir le fichier


Chargement…
Annuler
Enregistrer