# `Decibel.NonceError`
[🔗](https://github.com/ausimian/decibel/blob/1.2.1/lib/decibel/nonce_error.ex#L1)

Raised when a cipher nonce is exhausted, a caller supplies an invalid nonce,
or an outbound nonce would move backwards.

The `:reason` field distinguishes an exhausted CipherState, an out-of-range
value, and an outbound rewind. The `:nonce` field contains the offending
value. For a rewind, `:current_nonce` contains the unchanged outbound nonce;
it is `nil` for other reasons.

# `reason`

```elixir
@type reason() :: :exhausted | :out_of_range | :rewind
```

The reason a nonce operation failed.

# `t`

```elixir
@type t() :: %Decibel.NonceError{
  __exception__: true,
  current_nonce: non_neg_integer() | nil,
  message: String.t(),
  nonce: term(),
  reason: reason()
}
```

---

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