Skip to main content

value_error_to_eval_error

Function value_error_to_eval_error 

Source
pub fn value_error_to_eval_error(err: ValueError) -> EvalError
Expand description

Surface a builtin’s ValueError to the evaluator as a catchable condition.

Internal runtime errors (IndexOutOfBounds, WrongType, ArityError, …) are normalized into an EvalError::Thrown(Value::Error(..)) carrying the original ValueError variant and its plain display message — no runtime error: prefix — so that (catch :default e ..) / (catch Throwable e ..) bind a value on which ex-message / ex-data behave the same as for a user throw / ex-info. A ValueError::Thrown (a builtin re-throwing a Clojure value) is surfaced as that exact value.