Structured error from client validation or the DocRaptor API.
All public APIs return {:error, %DocRaptor.Error{}} on failure (no bang
functions). This is not an exception: there is no defexception, so do
not raise it and do not call Exception.message/1 on it — pattern-match
the struct (see Usage).
| Reason | When |
|---|---|
:missing_api_key | Client.new/1 without a non-empty :api_key |
:invalid_document | Local encode failed (name / type / content xor url) |
:api | Non-2xx HTTP or unexpected DocRaptor JSON |
:transport | Req/network failure before a usable HTTP response |
:timeout | DocRaptor.await_async_doc/3 exceeded :timeout_ms |
:async_failed | Async status reported failed |
Fields:
:reason— tagged atom above:message— human-readable summary (for:api, often extracted from XML<error>tags):status— HTTP status when available:body— raw response body (often binary), transport reason, or%Status{}
Summary
Types
@type reason() :: :missing_api_key | :invalid_document | :api | :transport | :timeout | :async_failed | atom()
@type t() :: %DocRaptor.Error{ body: term(), message: String.t(), reason: reason(), status: pos_integer() | nil }