# `WhisperCt2.Error`
[🔗](https://github.com/rubas/whisper_ct2/blob/v0.5.0/lib/whisper_ct2/error.ex#L1)

Structured error returned from `WhisperCt2` calls.

`reason` is one of:

- `:invalid_request` - bad arguments (bad path, malformed audio, oversized chunk).
- `:load_error`      - CTranslate2 could not load the model directory.
- `:inference_error` - the Whisper model returned an error during generation.
- `:runtime_error`   - internal NIF runtime fault (e.g. poisoned mutex).
- `:nif_panic`       - the Rust side panicked; should never happen in practice.
- `:native_error`    - fallback for unrecognised native error types.

# `reason`

```elixir
@type reason() ::
  :invalid_request
  | :load_error
  | :inference_error
  | :runtime_error
  | :nif_panic
  | :native_error
```

# `t`

```elixir
@type t() :: %WhisperCt2.Error{
  __exception__: true,
  details: map(),
  message: String.t(),
  reason: reason()
}
```

# `from_native`

```elixir
@spec from_native(map()) :: t()
```

# `new`

```elixir
@spec new(reason(), String.t(), map()) :: t()
```

---

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