예제 #1
0
    def testHandleException(self):
        xlog.setDebug('4')
        try:
            do_raise()
        except Error as e:
            error.handle_exception(self.logger, e, "Error handler:")

        self.assertEqual(1, len(self.keeper.errors))
        self.assertEqual(2, len(self.keeper.errors[0][1]))
        traceback = self.keeper.errors[0][1][1]
        self.assertIn(
            'feat/test/test_common_error.py',
            traceback)
예제 #2
0
    def testHandleFailure(self):
        xlog.setDebug('4')
        d = defer.succeed(None)
        d.addCallback(do_raise)
        d.addErrback(self._errback)
        yield d

        self.assertEqual(1, len(self.keeper.errors))
        self.assertEqual(2, len(self.keeper.errors[0][1]))
        traceback = self.keeper.errors[0][1][1]
        self.assertIn(
            'feat/test/test_common_error.py',
            traceback)
예제 #3
0
    def testExceptionInGateway(self):
        xlog.setDebug('4')
        root = Root(None)
        gate = gateway.Gateway(root, (5000, 10000), log_keeper=self.keeper,
                               label='Test gateway')
        yield gate.initiate()
        self.addCleanup(gate.cleanup)
        d = request('/_post', gate.port)
        self.assertFailure(d, WebError)
        yield d

        self.assertEqual(1, len(self.keeper.errors))
        self.assertEqual(2, len(self.keeper.errors[0][1]))
        traceback = self.keeper.errors[0][1][1]
        self.assertIn(
            "do_raise() #fail with 500 Internal Server Error",
            traceback)
예제 #4
0
파일: log.py 프로젝트: f3at/feat
 def set_debug(self, string):
     global flulog
     flulog.setDebug(string)