Twisted: how to get error parameters from failure?
问题 I have a piece of code: from twisted.web.client import getPage from twisted.internet import reactor class TestError(Exception): def __init__(self, message): self.message = message def __repr__(self): return 'TestError' def gotPage(response): print response reactor.stop() def gotErr(failure): raise TestError('This is error') def newEb(failure): try: failure.raiseException() except TestError as te: print te.message reactor.stop() if __name__ == '__main__': deferred = getPage('http://somebadpage