Skip to main content

Error handling

markpdf-cpp does not throw exceptions for API errors — it uses markpdf::Result<T, MarkpdfError> (see Reference). Only throw std::runtime_error on configuration errors (e.g. API key missing when building client).

MarkpdfError

Error table

Handle each case with switch

Automatic retries

  • 429 and 5xx: retries with exponential backoff and jitter, respecting Retry-After if the server sends it.
  • 4xx different from 429: not retried.
  • Connection errors (Connection): retried the same as 5xx.
Desactivar reintentos:

Job falvavalid

JobFailed means that the job has already exhausted internal server retries. Retrying from the client is reasonable, but do it with your own backoff.