Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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 hashes
Filename, size stfu-1.2.zip (1.9 kB) File type Source Python version None Upload date Hashes View hashes

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 SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page