Assent.HTTPAdapter.RequestError exception (Assent v0.4.0)

Copy Markdown View Source

An exception for when a provider rejects an HTTP request.

The :response field is omitted from Inspect output as it may contain sensitive data.

Fields

  • :message - a description of the error
  • :response - the normalized HTTP response

Examples

iex> error = %Assent.HTTPAdapter.RequestError{
...>   message: "Request failed",
...>   response: %Assent.HTTPAdapter.HTTPResponse{
...>     request: %Assent.HTTPAdapter.HTTPRequest{method: :get, url: "https://example.com"},
...>     http_adapter: Assent.HTTPAdapter.Httpc,
...>     status: 500,
...>     body: "Internal Server Error"
...>   }
...> }
iex> Exception.message(error)
"Request failed\n\nHTTP adapter: Assent.HTTPAdapter.Httpc\nRequest: GET https://example.com\nResponse status: 500\n"
iex> inspect(error)
"#Assent.HTTPAdapter.RequestError<message: \"Request failed\", ...>"

Summary

Types

t()

@type t() :: %Assent.HTTPAdapter.RequestError{
  __exception__: term(),
  message: binary(),
  response: Assent.HTTPAdapter.HTTPResponse.t()
}