Skip to main content

Catch exceptions via a context manager in Python

Project description

noerr

Catch exceptions via context manager in Python.

Super simple to use:

from noerr import no_err

with no_err:
    raise Exception("This won't crash my code!")

print("Yup, still going with no error!")

Also possible to log errors:

from noerr import log_err

with log_err:
    raise Exception("Should probably warn the user about this one.")

print("We now see the error, but don't stop because of it")

Outputs:

Exception logged by "LogError"
Traceback (most recent call last):
  File "<input>", line 4, in <module>
Exception: Should probably warn the user about this one.

We now see the error, but don't stop because of it

Install

pip install noerr

License

MIT License - Copyright (c) 2020 Chris Griffith - See LICENSE

Project details


Download files

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

Source Distribution

noerr-1.0.0a0.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

noerr-1.0.0a0-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page