Skip to main content

No project description provided

Project description

Run tests PyPI version

PyNom

A simple library to eat exceptions, until enough of a given exception type has been raised. The name has the word 'Nom' in it because it can sometimes sound like a person eating.

Installation

pip install pynom

Simple Usage Example

from pynom import PyNom
pn = PyNom([ValueError], 5)
while True:
    # This block will raise after 5 (so on the 6th) ValueErrors.
    #  It will raise an Exception containing tracebacks, exceptions, approx timestamps for each ValueError
    # If a non-ValueError is raised, it will be immediately raised (and not eaten)
    with pn:
        do_something()

Advanced Usage Example

from pynom import PyNom
pn = PyNom([ValueError], 5, throw_up_action=lambda ex: print(ex))
while True:
    # On the 6th value error will call the given throw_up_action
    #  a CombinedException will be passed to the throw_up_action.
    with pn:
        do_something()

See https://csm10495.github.io/pynom/ for full API documentation.

License

MIT 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

pynom-0.0.11.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

pynom-0.0.11-py3-none-any.whl (5.2 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