Skip to main content

Baiscally just an Exception class that retains traceback information

Project description

python2_wrapped__exception

This is basically an Exception class that would be used to wrap raised Exceptions.

The common use case is when one wants to present a custom exception class to a downstream caller.

One would typically do this:


try:
    doStuffTHatTHrowsAnException()
except Exception as e:
    raise MyCustomException(e.message)

However, the above code causes the execution stack at the time of the first exception to be lost.

The WrappedException allows us to do this:


try:
    doStuffTHatTHrowsAnException()
except Exception:
    WrappedException.throw()

Callers can now catch "WrappedException" and still have the original execution stack.

Alternatively, they can do this:


try:
    doStuffTHatTHrowsAnException()
except Exception as e:
    WrappedException(e.message, another_parameter, etc.).throw()

As WrappedException would typically be subclassed with a "business" exception.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wrap-exception, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size wrap_exception-0.0.2-py2-none-any.whl (1.6 kB) File type Wheel Python version py2 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page