llama-cpp-error-recorder 0.31.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
13
use std::error::Error;

use crate::frame_stack::FrameStack;

/// 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: impl Into<Box<dyn Error + Send + Sync>>) {
    FrameStack::record_into_top(error);
}