Пример #1
0
    def _handleListenerError(self, failure, msgCtx, data, listener):
        """Catch errors in message listeners.

        Just prints out a (hopefully informative) message
        about any errors that may have occurred.
        """
        print 'Unhandled error in message listener:', msgCtx, data, listener
        failure.printTraceback(elideFrameworkCode=1)
Пример #2
0
 def gotResolverError(self, failure, protocol, message, address):
     if isinstance(failure.value, (dns.DomainError, dns.AuthoritativeDomainError)):
         message.rCode = dns.ENAME
     else:
         message.rCode = dns.ESERVER
         print 'HEY IT IS A FAILURE'
         failure.printTraceback()
     self.sendReply(protocol, message, address)
     if self.verbose:
         log.msg("Lookup failed")
Пример #3
0
 def test_printStringExceptions(self):
     """
     L{Failure.printTraceback} should write out stack and exception
     information, even for string exceptions.
     """
     failure = self._getStringFailure()
     output = StringIO.StringIO()
     failure.printTraceback(file=output)
     lines = output.getvalue().splitlines()
     # The last line should be the value of the raised string
     self.assertEqual(lines[-1], self._stringException)
Пример #4
0
    def _gotError(self, failure, request, methodName, ns):
        self.info('_gotError %s %s', failure, failure.value)
        e = failure.value
        status = 500

        if isinstance(e, errorCode):
            status = e.status
        else:
            failure.printTraceback()

        response = soap_lite.build_soap_error(status)
        self._sendResponse(request, response, status=status)
Пример #5
0
    def on_failure(self, failure, request):
        """
        Handle exceptions raised during RestResource processing
        
        :param failure: ``twisted.python.failure.Failure`` instance
        :param request: ``twisted.web.server.Request`` instance
        """
        fq_name = self.__module__ + '.' + self.__class__.__name__
        file_path = abspath(inspect.getfile(self.__class__))

        if failure.check(CancelledError):
            # the request / deferred chain has been cancelled early.
            # doesn't matter if we respond no one is listening.
            rstr = err = 'Request was cancelled'
        elif failure.check(_DefGen_Return):
            failure.printBriefTraceback()
            err = dedent('''
                Received a Deferred Generator Response from Resource (%s)
                in the method:  [%s] ....................................
                This indicates you may be missing a yield statement and
                the decorator `@defer.inlineCallbacks`.
                File: %s
                
                If you do not have a yield statement, you should use a regular
                `return` statement and remove `defer.returnValue()`
            ''' % (fq_name, request.method_called, file_path)).strip()

            log.err(err + ' - ' + failure.getErrorMessage())
            rstr = self.ERROR_CLASS(
                INTERNAL_SERVER_ERROR,
                err,
                failure.getErrorMessage(),
                is_logged=False
            ).render(request)
        else:
            log.err('Exception in Resource (%s) [%s] <%s> - %s' % (
                fq_name, request.method_called, file_path, failure.getErrorMessage()))
            failure.printTraceback()
            rstr = self.ERROR_CLASS(
                INTERNAL_SERVER_ERROR,
                'Unhandled Error',
                'Exception in Resource (%s) [%s] <%s> - %s' % (
                    fq_name, request.method_called, file_path, failure.getTraceback()),
                is_logged=False
            ).render(request)

        if request.finished:
            return

        request.write(rstr)
        request.finish()
Пример #6
0
 def _errorCall(failure):
     assert isinstance(callId, int), "%r" % (callId,)
     failure.printTraceback()
     self.sendUI('exception', callId, str(failure))
Пример #7
0
def testFailed(failure):
    log.err("Failed in running a test inside a test list")
    failure.printTraceback()
Пример #8
0
def errorRunningTests(failure):
    log.err("There was an error in running a test")
    failure.printTraceback()
Пример #9
0
def itererror(failure, message):
    logger.info("itererror message: %s" % message)
    #logger.info("DEBUG: %s" % failure)
    #logger.info("DEBUG: %s" % dir(failure)
    failure.printTraceback()
    return failure
Пример #10
0
  def _handle_enqueue_error(self, failure):
    self._enqueue_in_progress = False

    failure.printTraceback()
Пример #11
0
  def _handle_error(self, failure):
    failure.printTraceback()

    return failure
Пример #12
0
 def failed(self, failure):
     """Callback for when the job fails."""
     failure.printTraceback()
     self.terminated()