Exmpeg.Error exception (exmpeg v0.3.0)

Copy Markdown View Source

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.

Summary

Types

reason()

@type reason() ::
  :invalid_request
  | :io_error
  | :decode_error
  | :encode_error
  | :unsupported
  | :runtime_error
  | :nif_panic
  | :native_error

t()

@type t() :: %Exmpeg.Error{
  __exception__: true,
  details: %{optional(String.t()) => String.t()},
  message: String.t(),
  reason: reason()
}

Functions

from_native(payload)

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

new(reason, message, details \\ %{})

@spec new(reason(), String.t(), %{optional(String.t()) => String.t()}) :: t()