rhai_trace
rhai_trace is a lightweight Rust library that enhances Rhai scripts with better error reporting and span tracking. It walks the script's AST, extracts spans for statements and expressions, and provides structured error information that can be used with any diagnostic or pretty-printing crate.
With rhai_trace, you can:
- Extract spans (start/end byte offsets, line, column) from Rhai scripts.
- Get detailed runtime error diagnostics including messages, hints, and notes.
- Integrate easily with crates like
ariadneor other diagnostic systems.
Quick Example
use ;
use Engine;
Full Example
For a complete working example showing integration with ariadne for pretty error reporting, see the example folder in the repository: