Error handling
@markpdf/nextjs reuses exceptions from @markpdf/sdk (MarkpdfAuthError, MarkpdfRateLimitError, etc.), all children of MarkpdfError. How you handle them depends on whether you are in a Route Handler or a Server Action.
In a Route Handler
createConvertRouteHandler already translates any MarkpdfError into a HTTP response with the same status code and a body { error: string }:
getServerClient, capture it yourself:
app/api/convert/route.ts
In a Server Action
Exceptions thrown within a Server Action arrive to the client as a serialized promise rejection. Capture them explicitly if you want to display a specific message in the UI instead of the generic Next.js error screen:app/actions.ts
Reintentos
getServerClient accepts the same retry options as MarkpdfClient:
