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.” :)

Project details


Download files

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

Source Distributions

stfu-1.2.zip (1.9 kB view details)

Uploaded Source

stfu-1.2.tar.gz (1.3 kB view details)

Uploaded Source

File details

Details for the file stfu-1.2.zip.

File metadata

  • Download URL: stfu-1.2.zip
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for stfu-1.2.zip
Algorithm Hash digest
SHA256 8ff0aeb44bd2eaff3e4f3698e6e952002b95538f11c42c40b60a4a3f8c9735b6
MD5 4f3cfaf26cf4ca243ff2444c9765cc32
BLAKE2b-256 ab7a803353975d0a8db7e9bfb8caec675804aa6faeaa00b310894b088b3c476f

See more details on using hashes here.

File details

Details for the file stfu-1.2.tar.gz.

File metadata

  • Download URL: stfu-1.2.tar.gz
  • Upload date:
  • Size: 1.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for stfu-1.2.tar.gz
Algorithm Hash digest
SHA256 c967348a8e11874bfa4d701116681d4a895c595838cb2f888624365f5d04ab2a
MD5 85734db6e5d3a7fdf8fbae4667e9e7fb
BLAKE2b-256 065f3336c217ac225069e05f12900eaac8a943cd50b3d7a08807de27e09bda57

See more details on using hashes here.

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