1use crate::{Val, ValType};2use jrsonnet_parser::{BinaryOpType, ExprLocation, UnaryOpType};3use std::{path::PathBuf, rc::Rc};45#[derive(Debug, Clone)]6pub enum Error {7 IntristicNotFound(Rc<str>, Rc<str>),8 IntristicArgumentReorderingIsNotSupportedYet,910 UnaryOperatorDoesNotOperateOnType(UnaryOpType, ValType),11 BinaryOperatorDoesNotOperateOnValues(BinaryOpType, ValType, ValType),1213 NoTopLevelObjectFound,14 CantUseSelfOutsideOfObject,15 CantUseSuperOutsideOfObject,1617 InComprehensionCanOnlyIterateOverArray,1819 ArrayBoundsError(usize, usize),2021 AssertionFailed(Val),2223 VariableIsNotDefined(String),24 TypeMismatch(&'static str, Vec<ValType>, ValType),25 NoSuchField(Rc<str>),2627 UnknownVariable(Rc<str>),2829 OnlyFunctionsCanBeCalledGot(ValType),30 UnknownFunctionParameter(String),31 BindingParameterASecondTime(Rc<str>),32 TooManyArgsFunctionHas(usize),33 FunctionParameterNotBoundInCall(Rc<str>),3435 UndefinedExternalVariable(Rc<str>),3637 FieldMustBeStringGot(ValType),3839 AttemptedIndexAnArrayWithString(Rc<str>),40 ValueIndexMustBeTypeGot(ValType, ValType, ValType),41 CantIndexInto(ValType),4243 StandaloneSuper,4445 ImportFileNotFound(PathBuf, PathBuf),46 ResolvedFileNotFound(PathBuf),47 ImportBadFileUtf8(PathBuf),48 ImportNotSupported(PathBuf, PathBuf),49 ImportSyntaxError(jrsonnet_parser::ParseError),5051 RuntimeError(Rc<str>),52 StackOverflow,53 FractionalIndex,54 DivisionByZero,55}5657#[derive(Clone, Debug)]58pub struct StackTraceElement(pub ExprLocation, pub String);59#[derive(Debug, Clone)]60pub struct StackTrace(pub Vec<StackTraceElement>);6162#[derive(Debug, Clone)]63pub struct LocError(pub Error, pub StackTrace);64pub type Result<V> = std::result::Result<V, LocError>;