Skip to main content

STFU those exceptions (explicitly)

Project description

Silence chosen exceptions.

Author: João Bernardo Oliveira - @jbvsmo

Replacement for the idiom:

>>> try:
...     may_raise_exception()
... except Exception:
...     pass

Just write:

>>> with stfu:
...     may_raise_exception()
>>> with stfu(TypeError, ValueError):
...     may_raise_exception()

To catch everything (even KeyboardInterrup and StopIteration):

>>> with stfu_all:
...     may_raise_any_exception()
“Errors should never pass silently.
Unless explicitly silenced.” :)

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
stfu-1.2.tar.gz (1.3 kB) Copy SHA256 hash SHA256 Source None Mar 15, 2013 (1.9 kB) Copy SHA256 hash SHA256 Source None Mar 15, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page