# `WhisperCpp.Error`
[🔗](https://github.com/rubas/whisper_cpp/blob/v0.2.0/lib/whisper_cpp/error.ex#L1)

Structured error returned from `WhisperCpp` calls.

`reason` is one of:

- `:invalid_request` - bad arguments (bad path, malformed audio).
- `:load_error`      - whisper.cpp could not load the GGML/GGUF model file.
- `:inference_error` - the Whisper model returned an error during decoding.
- `: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() :: %WhisperCpp.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*
