Expand description
Runtime Error Handling
Provides thread-local error state for FFI functions to report errors without panicking across the FFI boundary.
§Usage
FFI functions can set an error instead of panicking:
ⓘ
if divisor == 0 {
set_runtime_error("divide: division by zero");
return stack; // Return unchanged stack
}Callers can check for errors:
ⓘ
if patch_seq_has_error() {
let error = patch_seq_take_error();
// Handle error...
}Functions§
- clear_
runtime_ error - Clear any pending runtime error
- format_
panic_ payload - Format a panic payload into an error message
- has_
runtime_ error - Check if there’s a pending runtime error
- patch_
seq_ clear_ error - Clear any pending error (FFI-safe)
- patch_
seq_ get_ error - Get the last error message as a C string pointer (FFI-safe)
- patch_
seq_ has_ error - Check if there’s a pending runtime error (FFI-safe)
- patch_
seq_ take_ error - Take (and clear) the last error, returning it as a C string (FFI-safe)
- set_
runtime_ error - Set the last runtime error message
- take_
runtime_ error - Take (and clear) the last runtime error message