use crate::{Expr, InterpretError, InterpretErrorKind, Location};

/// Error handling extension trait.
pub trait InterpretErrorExt {
    /// Generate an error based on the current state of the interpreter.
    fn error(
        &self,
        expr: &Expr,
        kind: InterpretErrorKind,
        message: Option<&str>,
        help: Option<&str>,
    ) -> InterpretError;

    /// Generate an error at a specific location.
    fn error_at(
        &self,
        loc: &Location,
        length: Option<usize>,
        kind: InterpretErrorKind,
        message: Option<&str>,
        help: Option<&str>,
    ) -> InterpretError;
}
