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

Copy Markdown View Source

An exception for when an HTTP response is unexpected.

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

Fields

  • :response - the normalized HTTP response

Examples

iex> error = %Assent.HTTPAdapter.UnexpectedResponseError{
...>   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)
"unexpected response\n\nHTTP adapter: Assent.HTTPAdapter.Httpc\nRequest: GET https://example.com\nResponse status: 500\n"
iex> inspect(error)
"#Assent.HTTPAdapter.UnexpectedResponseError<...>"

Summary

Functions

Callback implementation for Exception.message/1.

Types

t()

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

Functions

message(exception)

Callback implementation for Exception.message/1.