Exceptions¶
The AnafError hierarchy — transport, auth, and configuration failures. Business
outcomes are typed values, not exceptions: see the
error model.
anafpy.exceptions ¶
Exception hierarchy for anafpy.
Per the design: exceptions are raised for transport / auth / programming errors.
Business outcomes (e.g. an e-Factura nok rejection with its BR-RO findings) are
returned as typed values, never raised.
AnafError ¶
Bases: Exception
Base class for every error raised by anafpy.
AnafConfigError ¶
Bases: AnafError
Invalid or missing configuration (credentials, paths, parameters).
AnafAuthError ¶
Bases: AnafError
OAuth/authentication failure (bad credentials, expired refresh token, ...).
AnafTransportError ¶
Bases: AnafError
A network-level failure talking to ANAF (connection, timeout, ...).
AnafResponseError ¶
AnafResponseError(message: str, *, status_code: int, body: str | None = None)
Bases: AnafTransportError
ANAF returned a non-success HTTP status.
Attributes:
| Name | Type | Description |
|---|---|---|
status_code |
the HTTP status code. |
|
body |
the (decoded) response body, if any, for diagnostics. |
AnafRateLimitError ¶
AnafRateLimitError(message: str = 'ANAF rate limit exceeded (429)', *, retry_after: float | None = None, body: str | None = None)
Bases: AnafResponseError
HTTP 429 — ANAF's rate limit (1000 req/min) was exceeded.
The client does not auto-retry; it surfaces retry_after (seconds) so the
caller can decide how to back off.