# `ExMLS.Error`
[🔗](https://github.com/ziyan-junaideen/ex_mls/blob/v0.1.0/lib/ex_mls/error.ex#L1)

A request failure with a stable `:reason` and, when available, an HTTP
`:status`. Error values omit credentials, URLs, response bodies, and
upstream exception details.

Authentication failures use these reasons.

  * `:unauthorized` or `:forbidden` for HTTP 401 or 403 from the feed,
    respectively.
  * `:token_request_failed` when the OAuth token endpoint cannot be reached
    or returns a status other than 200. A transport failure has no status.
  * `:invalid_token_response` when the token endpoint returns HTTP 200 with
    invalid JSON, an invalid bearer token or token type, or an invalid
    `expires_in` value. If present, `expires_in` must be a positive integer.

Other request failures use `:invalid_url`, `:unsafe_origin`,
`:http_error`, `:transport_error`, or `:invalid_response`.
Feed throttling is reported as `:http_error` with status 429. A malformed
collection page or a metadata response with an empty body or a missing or
unsupported content type uses `:invalid_response` with the HTTP status.

# `reason`

```elixir
@type reason() ::
  :unauthorized
  | :forbidden
  | :token_request_failed
  | :invalid_token_response
  | :invalid_url
  | :unsafe_origin
  | :http_error
  | :transport_error
  | :invalid_response
```

# `t`

```elixir
@type t() :: %ExMLS.Error{
  __exception__: term(),
  reason: reason(),
  status: pos_integer() | nil
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
