WhisperCpp.Error exception (whisper_cpp v0.2.0)

Copy Markdown View Source

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.

Summary

Types

reason()

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

t()

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

Functions

from_native(payload)

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

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

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