Пример #1
0
 def _treatData(self, data):
     try:
         new_message = IncomingMessage.deserialize(data)
     except Exception as ex:
         out_message = OutcomingMessage.errorSerializeMessage(ex.message)
         self._sendData(out_message.serialize())
     else:
         self._log.info("Received Command!")
         try:
             node = self._node_controller.findModule(new_message.module_path)
             node.execute(new_message)
             out_message = OutcomingMessage.okMessage(new_message, new_message.params)
             self._sendData(out_message.serialize())
         except Exception as ex:
             exc_type, exc_obj, exc_tb = sys.exc_info()
             fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
             message = "Exception: Type: {0} Name: {1} Line: {2} Messsage: {3}".format(exc_type, fname, exc_tb.tb_lineno, str(ex))
             out_message = OutcomingMessage.errorMessage(new_message, message)
             self._sendData(out_message.serialize())
Пример #2
0
 def _treatData(self, data):
     try:
         new_message = IncomingMessage.deserialize(data)
     except Exception, ex:
         out_message = OutcomingMessage.errorSerializeMessage(ex.message)
         self._sendData(out_message.serialize())