Project client failures to a fixed code and an optional HTTP status.
Use project/1 before logging or rendering an error. Provider descriptions,
response bodies, credentials, callback parameter names, key bytes, and
exception text are never included. Codes are a closed vocabulary; unknown
reasons become :unknown_error. This function does not choose response text
or a local response status for a host.
Bare documented reason atoms retain their names. Payload-bearing tuples
retain only their fixed tag. {:authorization_error, error, description}
becomes :authorization_error, regardless of either provider string.
{:oauth_error, status, body}, {:http_status, status}, and
{:unexpected_http_status, status} retain a status only when it is an
integer from 100 through 599. An issuer refresh wrapper retains a nested
HTTP status. {:invalid_state, reason} becomes :invalid_state and never
returns store details. A presentation's {query_id, reason} becomes
:presentation_error, discarding the identifier and retaining only a
recognized nested HTTP status. All other terms become :unknown_error.
Summary
Functions
Return %{code: code, http_status: status_or_nil} for a reason.
Types
@type projection() :: %{code: atom(), http_status: 100..599 | nil}
Functions
@spec project(term()) :: projection()
Return %{code: code, http_status: status_or_nil} for a reason.
Accepts either the reason itself or {:error, reason}. The returned code
comes only from the fixed library vocabulary, never from provider text.