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

The error returned (or raised by the `!` functions) by every operation.

`type` tells you what went wrong:

  * `:authentication` - HTTP 401, or an empty API key
  * `:validation` - HTTP 400, or a request rejected locally before it was sent
  * `:insufficient_credits` - HTTP 402
  * `:not_found` - HTTP 404
  * `:rate_limit` - HTTP 429 (see `retry_after`, in seconds)
  * `:timeout` - the request or a wait timed out
  * `:network` - the connection failed
  * `:api` - any other error status (409, 500, ...) or an unreadable response

`code` is the API's error code (for example `"INSUFFICIENT_CREDITS"`), `status`
the HTTP status (0 when no response was received) and `details` any extra
context the API sent.

# `t`

```elixir
@type t() :: %BillionVerify.Error{
  __exception__: term(),
  code: String.t(),
  details: term(),
  message: String.t(),
  retry_after: non_neg_integer() | nil,
  status: non_neg_integer(),
  type: type()
}
```

# `type`

```elixir
@type type() ::
  :authentication
  | :validation
  | :insufficient_credits
  | :not_found
  | :rate_limit
  | :timeout
  | :network
  | :api
```

---

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