TidyExc
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
Metadata
Release files for tidyexc 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tidyexc-0.10.0.tar.gz | 21.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tidyexc-0.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.6 kB
Release files / tidyexc-0.10.0.tar.gz
| Download URL | tidyexc-0.10.0.tar.gz |
|---|---|
| Size | 21.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06472f8894a282f944e6a102c5f6c5a58bb681589d58bbe1795c3905639581be
|
|
BLAKE2b-256 checksum How to use checksums |
f0f700111968245f33389ea749cc8490366ed711c125dd475bfa2035d7fc8dde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / tidyexc-0.10.0-py3-none-any.whl
| Download URL | tidyexc-0.10.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
26d6e3252e2bc58d9ad254b48bdca2bcf1f765d309e360563d32a7ac47085535
|
|
BLAKE2b-256 checksum How to use checksums |
8f4534d2de24e0973cdbd1839f030f5bda4ab25fa7993735382ed91d7afdff38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|