Release 46c53c04e2e1e8f0bb8c1b51250a9f84; Exception message added for response callbacks

This commit is contained in:
Dirk Alders 2021-01-11 11:43:07 +01:00
parent 92c40ce9ab
commit da432a9340
3 changed files with 46662 additions and 46596 deletions

View File

@ -475,11 +475,11 @@ class pure_json_protocol(object):
status = STATUS_BUFFERING_UNHANDLED_REQUEST
data = None
else:
self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
try:
self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
status, data = callback(msg, *args, **kwargs)
except Exception as e:
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())))
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())))
status = STATUS_CALLBACK_ERROR
data = None
else:
@ -490,7 +490,10 @@ class pure_json_protocol(object):
self.__buffer_received_data__(msg)
else:
self.logger.debug("%s Executing callback %s to process received data", self.__log_prefix__(), callback.__name__)
callback(msg, *args, **kwargs)
try:
callback(msg, *args, **kwargs)
except Exception as e:
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())))
return # No response needed
self.send(self.__sid_response_dict__[msg.get_service_id()], msg.get_data_id(), data, status=status)

File diff suppressed because it is too large Load Diff

Binary file not shown.