Skip to content

DataExcept

Structured, hierarchical exception classes for data science, machine learning and data engineering workflows.

Instead of debugging a bare ValueError, you get an exception that says what actually went wrong, where, and with which value:

from dataexcept import ValidationError

raise ValidationError("age", -1)
# ValidationError: Validation failed for field 'age': -1

Installation

pip install DataExcept

Where to go next

  • Command-Line Interface — inspect the exported exception classes and check the installed version.
  • Logging Helpers — log exceptions with structured context and re-raise without losing the traceback.
  • Advanced Usage — derive your own project-specific errors from the provided base classes.
  • API Reference — every exception and helper, generated from the source.

Describing a failure

  • Cause-aware Exceptions — wrap a third-party failure so the traceback shows both, without writing the wiring by hand.
  • Failure Metadata — say whether a failure is transient, permanent or unclassified, and how long to wait.
  • Parsing Context — report a failure on untrusted content without keeping the content.
  • Message Brokers — publish, consume and acknowledgement failures, with the topic, partition and offset that say where.

Crossing a boundary

  • Envelope Schema — the versioned, language-neutral JSON contract for an exported exception, with fixtures.
  • Pino Interoperability — the same failure in the shape a Node.js logger reads, projected from the envelope.
  • Observability — keep stable operation context, correlation identifiers and W3C trace continuity across HTTP, workers and workflow/orchestrator boundaries without adding framework dependencies.
  • Sentry Integration — enrich Sentry error events with the redacted DataExcept envelope and filterable failure tags, without adding a Sentry runtime dependency.

What is guaranteed not to break, and what a version bump means, is written down in the stability policy.

Local Lambda demo

The repository ships with a .env.example and a matching make target, so you can run the mocked Lambda workflow without touching real infrastructure:

make lambda-demo

The target copies .env.example to .env if it is missing, then runs python -m examples.lambda_main.