{ } Raw JSON

bundles / papyri 0.0.10 / papyri / error_collector

module

papyri.error_collector

source: /papyri/error_collector.py:0

Members

Summary

Error bookkeeping for papyri gen.

Extended Summary

ErrorCollector is a context manager that wraps each per-qualname generation step. It distinguishes two buckets of failures:

  • expected — listed under [global.expected_errors] in the package's gen TOML; these don't fail the build.

  • unexpected — anything else; logged with a traceback and re-raised when early_error is set.

A third state, fail_unseen_error, raises UnseenError when an expected error never actually fired (so the allow-list stays trimmed).

Gen-time diagnostics live here too (Severity, the DIAGNOSTICS code registry, DiagnosticConfig resolver, and the Diagnostics collector). Unlike ErrorCollector — which deals with exceptions that abort a per-object step — diagnostics are non-fatal observations (an unresolved cross-reference, a malformed docstring section, a broken doctest) emitted from deep inside gen/tree without unwinding. Every diagnostic has a stable code and a default severity; the project's papyri.toml can override severities globally and per fully-qualified target glob (mirroring ruff/mypy). papyri gen exits non-zero when any diagnostic resolves to error.

Additional content

Error bookkeeping for papyri gen.

ErrorCollector is a context manager that wraps each per-qualname generation step. It distinguishes two buckets of failures:

  • expected — listed under [global.expected_errors] in the package's gen TOML; these don't fail the build.

  • unexpected — anything else; logged with a traceback and re-raised when early_error is set.

A third state, fail_unseen_error, raises UnseenError when an expected error never actually fired (so the allow-list stays trimmed).

Gen-time diagnostics live here too (Severity, the DIAGNOSTICS code registry, DiagnosticConfig resolver, and the Diagnostics collector). Unlike ErrorCollector — which deals with exceptions that abort a per-object step — diagnostics are non-fatal observations (an unresolved cross-reference, a malformed docstring section, a broken doctest) emitted from deep inside gen/tree without unwinding. Every diagnostic has a stable code and a default severity; the project's papyri.toml can override severities globally and per fully-qualified target glob (mirroring ruff/mypy). papyri gen exits non-zero when any diagnostic resolves to error.

Aliases

  • papyri.error_collector