Categorised exceptions and CLI error-reporting boundary for the oaknut package family.
Project description
oaknut-exception
Categorised exceptions and a CLI error-reporting boundary for the
oaknut-* family of packages.
The package defines a small exception hierarchy that every other
oaknut-* package's domain errors slot into:
OaknutException— root of the hierarchy. Carries anexit_codeproperty derived from the BSDsysexits.hset (via theexit-codespackage).DataError— the operation failed because of the data it was given (a user-supplied path, a corrupted on-disc structure, an unsupported filetype). No traceback at the CLI boundary.ConfigurationError— the operation failed because of a runtime environment / configuration issue. No traceback at the CLI boundary.InternalError— the operation failed because something went wrong inside the library. Traceback retained at the CLI boundary so the report-an-issue path is obvious.
Plus a single error-handling boundary helper:
handled_errors— a context manager (also usable as a decorator) that catchesDataErrorandConfigurationError, prints them via a caller-supplied printer, and exits with the most appropriateExitCode.InternalErrorand unexpected exceptions propagate so their tracebacks reach the user.KeyboardInterruptexits with the conventional128 + SIGINTstatus.
This package is what every oaknut-disc-like CLI uses to map library
errors onto stable exit codes without dropping into try/except in every
command.
See the oaknut documentation for the full API reference.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oaknut_exception-12.2.0.tar.gz.
File metadata
- Download URL: oaknut_exception-12.2.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d29b53a292f337064169115fc963a6e44124f30b74b7e0ff71ac43ddd230729
|
|
| MD5 |
7d961414bb0aa4483f081e8e5b9cf32c
|
|
| BLAKE2b-256 |
3640935625965eba64b61d60608e6fc1ea823ab34b296f7dd1354b0c550ebe90
|
File details
Details for the file oaknut_exception-12.2.0-py3-none-any.whl.
File metadata
- Download URL: oaknut_exception-12.2.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2afa5f47c0ec9f2def2d857cb30c1252d2222eb50d1c2f8dd40dd48fbfc79513
|
|
| MD5 |
a06901eeb12637ca48cf7b47f54eb9d2
|
|
| BLAKE2b-256 |
6c7479eeda4860cdd168ebf1aef862297e57162cbba8819401aa1e6264d7cbfe
|