feat: error handling

This commit is contained in:
2025-08-08 19:35:51 +08:00
parent a9cfddbf5c
commit fd182b6233
12 changed files with 187 additions and 311 deletions

View File

@@ -32,11 +32,17 @@ pub enum Error {
ResolutionError(String),
/// An error occurred during the final evaluation of the LIR. This covers
/// all runtime errors, such as type mismatches (e.g., adding a string to
/// an integer), division by zero, or failed `assert` statements.
/// all unrecoverable runtime errors, such as type mismatches (e.g., adding
/// a string to an integer), division by zero, or primitive operation
/// argument arity mismatch
#[error("error occurred during evaluation stage: {0}")]
EvalError(String),
/// Represents an error that can be generated by `throw` or `assert`, and
/// can be caught by `builtins.tryEval`.
#[error("{0}")]
Catchable(String),
/// A catch-all for any error that does not fit into the other categories.
#[error("an unknown or unexpected error occurred")]
Unknown,