Skip to main content

Module error

Module error 

Source
Expand description

Captured MLX-C error translation.

MLX C reports an error immediately before returning nonzero on the same calling thread, so the capture machinery pairs those two observations thread-locally. This module only translates what MLX-C reported; typed classification of embedding-specific error markers (for example an active memory ceiling) is embedding policy: the consumer converts MlxCError values at its own boundary.

Payload trampolines cannot return Rust errors across the C ABI, so they park their typed failure in a separate thread-local slot and return nonzero; status translation prefers that parked failure because it is the root cause, while MLX-C’s status text only reports that a callback errored.

Structs§

MlxCError
One failed MLX-C operation: what was attempted and what MLX-C reported.

Functions§

check_status
Translates an MLX-C status into Ok(()) or a captured MlxCError.
clear_captured_mlx_error
Discards the captured MLX-C error description for the calling thread.
clear_closure_error
Discards the parked payload-closure failure for the calling thread.
install_non_terminating_error_handler
Installs the non-terminating MLX-C error handler exactly once per process.
set_closure_error
Parks a payload-closure failure for the calling thread’s status check.
take_captured_mlx_error
Takes the captured MLX-C error description for the calling thread, if any.
take_closure_error
Takes the parked payload-closure failure for the calling thread, if any.