Skip to main content

Error handling

The SDK translates each HTTP error code of the API into a typed exception, all inheriting from MarkpdfError.

Exceptions table

They all inherit from markpdf.MarkpdfError, which states:
int | None
Original HTTP code, or None for network errors.
str
Message detail returned by API.
str | None
If the response brings a request id header, it is exposed here to report the problem.
##Catch specific exceptions

Automatic retries

The client automatically retries 429 and 5xx with exponential backoff up to max_retries (default 2):
  • 429 and 5xx: retried. Respect the Retry-After header if present; if not, use exponential backoff with jitter.
  • 4xx other than 429: not retried — the error almost always means that the request must be corrected, not repeated.
  • Network errors (MarkpdfConnectionError): retried the same as 5xx.
To disable SDK retries and handle them yourself:

Job falvavalid

MarkpdfJobFailedError means that the job has already exhausted internal server retries. Retrying the same conversion from the client is reasonable, but do it with backoff — all backends are probably still saturated.