#[non_exhaustive]pub enum Error {
Show 18 variants
InvalidArgument(String),
NotImplemented(String),
ModelFileNotFound(String),
ModelLoad(String),
OutOfMemory(String),
Backend(String),
Unsupported(String),
BadStructSize(String),
InputTooLong(String),
Aborted {
message: String,
partial: Option<Box<Transcript>>,
},
OutputTruncated {
message: String,
partial: Option<Box<Transcript>>,
},
OutputRepetition {
message: String,
partial: Option<Box<Transcript>>,
},
UnsupportedRole(String),
InputTooShort(String),
VersionMismatch(String),
Nul(NulError),
Busy(String),
Other(String),
}Expand description
Everything that can go wrong talking to the native library.
Match on the variant for typed handling; Error::raw_status recovers the
underlying transcribe_status code (0 for errors raised purely on the Rust
side, e.g. the load-time version gate or a NUL in a caller string).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidArgument(String)
TRANSCRIBE_ERR_INVALID_ARG (or _SAMPLE_RATE).
NotImplemented(String)
TRANSCRIBE_ERR_NOT_IMPLEMENTED — the model has no path for this call.
ModelFileNotFound(String)
TRANSCRIBE_ERR_FILE_NOT_FOUND — the GGUF path does not exist.
ModelLoad(String)
TRANSCRIBE_ERR_GGUF / _UNSUPPORTED_ARCH / _UNSUPPORTED_VARIANT.
OutOfMemory(String)
TRANSCRIBE_ERR_OOM.
Backend(String)
TRANSCRIBE_ERR_BACKEND — the requested backend could not be satisfied.
Unsupported(String)
TRANSCRIBE_ERR_UNSUPPORTED_{TASK,LANGUAGE,TIMESTAMPS,PNC,ITN} — the
model cannot satisfy this request shape.
BadStructSize(String)
TRANSCRIBE_ERR_BAD_STRUCT_SIZE — an ABI/struct-size fault. With the
generated FFI this indicates a header/library skew, not caller error.
InputTooLong(String)
TRANSCRIBE_ERR_INPUT_TOO_LONG — audio longer than the model can decode.
Aborted
TRANSCRIBE_ERR_ABORTED — the abort callback returned true. The
transcript of chunks that completed before the abort is preserved.
Fields
partial: Option<Box<Transcript>>Partial transcript from chunks that completed before the abort.
OutputTruncated
TRANSCRIBE_ERR_OUTPUT_TRUNCATED — the decode hit the generation budget
before end-of-stream; the transcript is incomplete by contract. The
partial transcript is always preserved.
Fields
partial: Option<Box<Transcript>>The (incomplete) transcript produced before truncation.
OutputRepetition
TRANSCRIBE_ERR_OUTPUT_REPETITION — the decode was stopped because the
output began repeating itself; the transcript is incomplete by contract.
The partial transcript, with the repeats dropped, is always preserved.
Fields
partial: Option<Box<Transcript>>The (incomplete) transcript produced before the loop, one copy kept.
UnsupportedRole(String)
TRANSCRIBE_ERR_UNSUPPORTED_ROLE — see Model::roles.
InputTooShort(String)
TRANSCRIBE_ERR_INPUT_TOO_SHORT — the audio is shorter than the role’s
minimum (e.g. LangIdInfo::min_audio_ms).
VersionMismatch(String)
The loaded library’s base version disagrees with the headers this crate was generated against (the pre-1.0 version lock). Raised on first use.
Nul(NulError)
A caller-supplied string contained an interior NUL byte.
Busy(String)
Another session of the same model already has a compute operation in
flight. The C library serializes compute per model (the 0.x limitation):
at most one run / batch / active stream across ALL of a model’s sessions
at a time. Finish or drop the in-flight stream (one-shot runs/batches
just queue) before starting another, or give each concurrent worker its
own model. Raised purely on the Rust side, so Error::raw_status is 0.
Other(String)
A non-OK status with no more specific mapping.
Implementations§
Source§impl Error
impl Error
Sourcepub fn raw_status(&self) -> i32
pub fn raw_status(&self) -> i32
The transcribe_status this error was mapped from, or 0 for errors
raised on the Rust side (version gate, NUL in a string, …).
Sourcepub fn partial(&self) -> Option<&Transcript>
pub fn partial(&self) -> Option<&Transcript>
The partial transcript carried by Error::Aborted /
Error::OutputTruncated / Error::OutputRepetition, if any. None
for every other variant.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<&Error> for ErrorReport
impl From<&Error> for ErrorReport
Source§impl From<Error> for ErrorReport
Moves the partial transcript out instead of cloning it.
impl From<Error> for ErrorReport
Moves the partial transcript out instead of cloning it.