Skip to main content

An exception class inspired by the tidyverse style guide.

Project description

Last release Python version Documentation Test status Test coverage Last commit

TidyExc provides an exception base class that makes it easy to raise rich, helpful exceptions:

  • Rich: Instead of simply storing an error message, TidyExc exceptions separately store parameters and message templates. This separation makes it easier for exception handling code to access information describing the error and to respond accordingly.

  • Helpful: TidyExc is inspired by the error message conventions promoted by the tidyverse style guide. Briefly, these conventions state that an error message should consist of a brief statement of the problem, followed by a bullet-point list of relevant contextual information. The bullet-point format makes it easy to include lots of detail, without the detail becoming overwhelming.

The following example shows TidyExc in action:

>>> from tidyexc import Error
>>> class CheeseShopError(Error):
...     pass
...
>>> err = CheeseShopError(
...         product_name="Red Leicester",
...         num_requested=1,
...         num_available=0,
... )
>>> err.brief = "insufficient inventory to process request"
>>> err.info += "{num_requested} {product_name} requested"
>>> err.blame += "{num_available} available"
>>> raise err
Traceback (most recent call last):
  ...
CheeseShopError: insufficient inventory to process request
• 1 Red Leicester requested
✖ 0 available

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

tidyexc-0.10.0.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

tidyexc-0.10.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file tidyexc-0.10.0.tar.gz.

File metadata

  • Download URL: tidyexc-0.10.0.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/37.3 requests/2.28.1 requests-toolbelt/0.10.1 urllib3/1.26.13 tqdm/4.64.1 importlib-metadata/5.1.0 keyring/23.11.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.9

File hashes

Hashes for tidyexc-0.10.0.tar.gz
Algorithm Hash digest
SHA256 06472f8894a282f944e6a102c5f6c5a58bb681589d58bbe1795c3905639581be
MD5 6429b9778eb36797a069adf8d05b402f
BLAKE2b-256 f0f700111968245f33389ea749cc8490366ed711c125dd475bfa2035d7fc8dde

See more details on using hashes here.

File details

Details for the file tidyexc-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: tidyexc-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/37.3 requests/2.28.1 requests-toolbelt/0.10.1 urllib3/1.26.13 tqdm/4.64.1 importlib-metadata/5.1.0 keyring/23.11.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.9

File hashes

Hashes for tidyexc-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26d6e3252e2bc58d9ad254b48bdca2bcf1f765d309e360563d32a7ac47085535
MD5 cc34f5277da9e5c2068c03c4d9ebc182
BLAKE2b-256 8f4534d2de24e0973cdbd1839f030f5bda4ab25fa7993735382ed91d7afdff38

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