Table of Contents

Class: Failure | Twisted-0.17.4/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__ 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 )

| 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.

Exceptions |
--- | ---
self

Table of Contents

This document was automatically generated on Sat Apr 20 01:31:23 2002 by HappyDoc version 2.0