infi.exceptools

a mechanism for chaining exceptions, compatible with Python 2.x


License
BSD-3-Clause
Install
pip install infi.exceptools==0.2.15

Documentation

Overview

This module features exception chaining.

Usage

Here's an example on how to use this module:

In [1]: from infi.exceptools import chain

In [2]: def example():
   ...:     try:
   ...:         raise RuntimeError()
   ...:     except:
   ...:         raise chain(Exception())
   ...:     

In [3]: try:
   ...:     example()
   ...: except Exception, exc:
   ...:     pass
   ...: 

In [4]: exc.__class__
Out[4]: Exception

In [5]: exc.__cause__.__class__
Out[5]: RuntimeError

Checking out the code

Run the following:

easy_install -U infi.projector
projector devenv build