Skip to main content

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 an exit_code property derived from the BSD sysexits.h set (via the exit-codes package).
  • 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 catches DataError and ConfigurationError, prints them via a caller-supplied printer, and exits with the most appropriate ExitCode. InternalError and unexpected exceptions propagate so their tracebacks reach the user. KeyboardInterrupt exits with the conventional 128 + SIGINT status.

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


Download files

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

Source Distribution

oaknut_exception-11.0.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oaknut_exception-11.0.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file oaknut_exception-11.0.1.tar.gz.

File metadata

  • Download URL: oaknut_exception-11.0.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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

Hashes for oaknut_exception-11.0.1.tar.gz
Algorithm Hash digest
SHA256 861eea2d50f69f09426dfdb1c7a42dfa73ef038a775748f3ac2cb33c547f074a
MD5 0d6be6aa48effe26b3e3bebcac161d68
BLAKE2b-256 f37b38c30f190a8bd3b9f3fe65281f255f226f150db70096a2a5840787c1eccd

See more details on using hashes here.

File details

Details for the file oaknut_exception-11.0.1-py3-none-any.whl.

File metadata

  • Download URL: oaknut_exception-11.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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

Hashes for oaknut_exception-11.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37b9b576b354f09d1716ba5128070c69023367a8d91236cdb72705c3d4a1a4e0
MD5 b0f3aec35ddcadb42306fb095f15fcff
BLAKE2b-256 987f6f5a2b81b2f42fa97bcb0fb4d90012aac83afb583ebaa5d9e55cbcf4e9d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page