# `Exmpeg.Error`
[🔗](https://github.com/rubas/exmpeg/blob/v0.3.0/lib/exmpeg/error.ex#L1)

Structured error returned from `Exmpeg` calls.

`reason` is one of:

- `:invalid_request` - bad arguments (missing path, malformed opts, non-numeric times).
- `:io_error`        - libavformat could not open or read the input / output file.
- `:decode_error`    - the decoder rejected a packet or could not drain a frame.
- `:encode_error`    - the encoder rejected a frame or could not drain a packet.
- `:unsupported`     - the build of FFmpeg this NIF is linked against has no muxer / demuxer / codec for the request.
- `:runtime_error`   - internal NIF runtime fault (e.g. unexpected ffmpeg state).
- `: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
  | :io_error
  | :decode_error
  | :encode_error
  | :unsupported
  | :runtime_error
  | :nif_panic
  | :native_error
```

# `t`

```elixir
@type t() :: %Exmpeg.Error{
  __exception__: true,
  details: %{optional(String.t()) =&gt; String.t()},
  message: String.t(),
  reason: reason()
}
```

# `from_native`

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

# `new`

```elixir
@spec new(reason(), String.t(), %{optional(String.t()) =&gt; String.t()}) :: t()
```

---

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