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.

Files for stfu, version 1.2
Filename, size File type Python version Upload date Hashes
Filename, size stfu-1.2.tar.gz (1.3 kB) File type Source Python version None Upload date Hashes View
Filename, size stfu-1.2.zip (1.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page