llama-cpp-error-recorder 0.11.0

Captures errors raised inside FFI callbacks (which cannot unwind or return Result) for retrieval by the Rust code that drove the call
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::frame_stack;
use crate::recorded_error::RecordedError;

/// Records an error raised inside an FFI callback so the Rust code that drove
/// the FFI call can surface it via [`crate::error_scope::ErrorScope::take`].
///
/// Only the first error recorded in the active scope is kept. If no scope is
/// active the error is dropped: recording runs inside an FFI callback, where
/// unwinding is undefined behaviour, so it must never panic.
pub fn record(error: RecordedError) {
    frame_stack::record_into_top(error);
}