pub enum ShimError {
Nul(NulError),
InvalidArg,
BadJson(String),
Failed(String),
Init(String),
Utf8(FromUtf8Error),
CorruptResult,
}Expand description
The error type every shim-backed module shares.
chat::ChatError, ngram::NgramError, common_sampler::CommonSamplerError
and runtime::RuntimeError are all aliases of this one type: the C shims
share a status enum and a thread-local error buffer, so they share an error.
Re-exported here because those aliases are public API and their variants
should be documented somewhere reachable.
A failure inside one of llama.cpp’s C++ layers, reported through a shim.
One type for every shim-backed module. The variants are the union of what the shims can report; a given call only produces the ones its documentation names.
Variants§
Nul(NulError)
An argument contained an interior NUL byte, so it could not become a
CString. Caught in Rust — truncating at the NUL would silently change
the value.
InvalidArg
A required pointer argument was null, or a value was out of range.
BadJson(String)
Input was not valid JSON.
Failed(String)
llama.cpp threw. The message is what the exception carried.
Init(String)
A constructor returned null.
Utf8(FromUtf8Error)
Output was not valid UTF-8.
CorruptResult
A shim reported an offset outside the buffer it described, which would mean the shim and this crate disagree about the layout.
Trait Implementations§
Source§impl Error for ShimError
impl Error for ShimError
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()