# `AppBlockList.Error`
[🔗](https://github.com/explainableaixai/appblocklist-elixir/blob/v1.0.0/lib/appblocklist/error.ex#L1)

Error returned (or raised by the bang functions) for anything other than
a 200 or 404 answer.

| reason            | HTTP | meaning                                               |
|-------------------|------|-------------------------------------------------------|
| `:invalid_id`     | 400  | id missing, too long, or not a recognised identifier  |
| `:unauthorized`   | 401  | missing or invalid API key                            |
| `:quota_exceeded` | 403  | monthly lookups used; see `monthly_lookups/1`         |
| `:server_error`   | 5xx  | temporary, safe to retry                              |
| `:transport`      | none | network failure, timeout or a body that is not JSON   |
| `:unexpected`     | other| any other status                                      |

# `reason`

```elixir
@type reason() ::
  :invalid_id
  | :unauthorized
  | :quota_exceeded
  | :server_error
  | :transport
  | :unexpected
```

# `t`

```elixir
@type t() :: %AppBlockList.Error{
  __exception__: true,
  body: map(),
  message: String.t(),
  reason: reason(),
  status: non_neg_integer() | nil
}
```

# `monthly_lookups`

```elixir
@spec monthly_lookups(t()) :: integer() | nil
```

The `monthly_lookups` value from a 403 body, or nil.

# `retryable?`

```elixir
@spec retryable?(t()) :: boolean()
```

True for errors worth retrying later (5xx and transport).

---

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