Example #1
0
 def put_exception(self,error,message_listening_queues_map):
     '''
     Places an ApplicationExceptionCallResult or NetworkFailureCallResult in 
     the event complete queue to indicate to the endpoint that an exception
     has been raised. This allows the exception to be propagated back.
     '''
     if isinstance(error, util.NetworkException):
         self.result_queue.put(_NetworkFailureCallResult(error.trace))
     elif isinstance(error, util.ApplicationException):
         self.result_queue.put(_ApplicationExceptionCallResult(error.trace))        
     elif isinstance(error, Exception):
         tb = traceback.format_exc()
         self.result_queue.put(_ApplicationExceptionCallResult(tb))
Example #2
0
    def send_exception_to_listener(self, error):
        '''
        @param     error     GeneralMessage.error

        Places an ApplicationExceptionCallResult in the event complete queue to 
        indicate to the endpoint that an application exception has been raised 
        somewhere down the call graph.

        Note that the type of error is 
        '''
        self._lock()
        # Send an ApplicationExceptionCallResult to each listening queue
        for reply_with_uuid in self.message_listening_queues_map.keys():
            ### FIXME: It probably isn't necessary to send an exception result to
            ### each queue.
            message_listening_queue = self.message_listening_queues_map[reply_with_uuid]
            if error.type == PartnerError.APPLICATION:
                message_listening_queue.put(_ApplicationExceptionCallResult(error.trace))
            elif error.type == PartnerError.NETWORK:
                message_listening_queue.put(_NetworkFailureCallResult(error.trace))
        self._unlock()