Table of Contents

Class: Failure | Twisted-0.19.0/twisted/python/failure.py
--- | ---
### A basic abstraction for an error that has occurred. This is necessary because Python's built-in error mechanisms are inconvenient for asynchronous communication.
Methods |
--- | ---
__getstate__ __init__ __repr__ check getBriefTraceback | getErrorMessage printBriefTraceback printDetailedTraceback printTraceback trap
| __getstate__
    __getstate__ ( self )
Avoid pickling objects in the traceback.
| __init__
    __init__ (
            self,
            exc_value=None,
            exc_type=None,
            exc_tb=None,
            )
### Initialize me with an explanation of the error. By default, this will use the current exception (sys.exc_info()). However, if you want to specify a particular kind of failure, you can pass an exception as an argument.
| __repr__
    __repr__ ( self )
| check
    check ( self,  *errorTypes )
| getBriefTraceback
    getBriefTraceback ( self )
| getErrorMessage
    getErrorMessage ( self )
| printBriefTraceback
    printBriefTraceback ( self,  file=None )
Print a traceback as densely as possible.
| printDetailedTraceback
    printDetailedTraceback ( self,  file=None )
Print a traceback with detailed locals and globals information.
| printTraceback
    printTraceback ( self,  file=None )
Emulate Python's standard error reporting mechanism.
| trap
    trap ( self,  *errorTypes )
### Trap this failure if its type is in a predetermined list. This allows you to trap a Failure in an error callback. It will be automatically re-raised if it is not a type that you expect. The reason for having this particular API is because it's very useful in Deferred errback chains: | def _ebFoo(self, failure): | r = failure.trap(Spam, Eggs) | print `The Failure is due to either Spam or Eggs!` | if r == Spam: | print `Spam did it!` | elif r == Eggs: | print `Eggs did it!` If the failure is not a Spam or an Eggs, then the Failure will be `passed on` to the next errback.
Exceptions |
--- | ---
self

Table of Contents

This document was automatically generated on Sun Jul 14 19:53:11 2002 by HappyDoc version 2.0