The single error type returned by every Corvo NFS-e API call.
Each field mirrors the wire error contract shared by all Corvo SDKs:
:status- HTTP status code;0for network/timeout failures.:code- stable machine-readable code ("ERROR_VALIDATION","http_500","network_error","timeout","invalid_json").:message- human-readable message.:details- list of%{"field" => ..., "code" => ..., "message" => ...}maps for body validation failures (passed through unchanged).:request_id-requestIdbody field orX-Request-Idheader.:retry_after- seconds to wait, fromretryAfterorRetry-After.
API, network and timeout failures are returned as {:error, %CorvoNfse.Error{}}
instead of raised. The struct is nevertheless a proper exception so the one
documented raising site - a subsequent page failure inside an iterate
stream - can raise it.
Examples
iex> CorvoNfse.Error.message(%CorvoNfse.Error{message: "company not found"})
"company not found"
iex> CorvoNfse.Error.message(%CorvoNfse.Error{status: 404, code: "http_404"})
"Corvo NFS-e API error (status=404, code=\"http_404\")"
Summary
Types
@type t() :: %CorvoNfse.Error{ __exception__: true, code: String.t() | nil, details: [detail()] | nil, message: String.t() | nil, request_id: String.t() | nil, retry_after: non_neg_integer() | nil, status: non_neg_integer() | nil }