# `KapsoEx.Error`
[🔗](https://github.com/rocket4ce/kapso_ex/blob/v0.1.0/lib/kapso_ex/error.ex#L1)

Returned as `{:error, %KapsoEx.Error{}}` when a request fails.

## Fields

  * `:status` - HTTP status code, or `nil` for transport errors.
  * `:message` - human readable message extracted from the response body.
  * `:code` - error code from the body when present. Meta-style errors from
    the WhatsApp API carry an integer code (for example `131047`), Platform
    errors may carry a string code (for example `"findings_not_enabled"`).
  * `:body` - the decoded response body.
  * `:headers` - response headers, a map of lowercase name to list of values.
  * `:retry_after` - seconds from the `Retry-After` header, when present.
    Set on `429` responses.
  * `:reason` - the underlying exception for transport errors (timeouts,
    connection refused, ...).

# `t`

```elixir
@type t() :: %KapsoEx.Error{
  __exception__: true,
  body: term(),
  code: integer() | String.t() | nil,
  headers: %{optional(String.t()) =&gt; [String.t()]},
  message: String.t(),
  reason: Exception.t() | nil,
  retry_after: non_neg_integer() | nil,
  status: non_neg_integer() | nil
}
```

---

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