Skip to main content

A simple wrapper around contextlib.suppress

Project description

Suppres

Decorator to ignore exceptions in functions. A simple wrapper around contextlib.suppress.

Install

pip install suppress

Usage

from suppress import suppress


@suppress(ZeroDivisionError)
def zero_error_function():
    1/0


def main():
    print('First print')
    zero_error_function()
    print('Second print')


if __name__ == '__main__':
    main()

Output:

First print
Second print

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

suppress-0.1.0.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

suppress-0.1.0-py2.py3-none-any.whl (2.3 kB view hashes)

Uploaded Python 2 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