1use crate::ValType;2use jsonnet_parser::ExprLocation;3use std::{path::PathBuf, rc::Rc};45#[derive(Debug, Clone)]6pub enum Error {7 VariableIsNotDefined(String),8 TypeMismatch(&'static str, Vec<ValType>, ValType),9 IntristicArgumentReorderingIsNotSupportedYet,10 NoSuchField(Rc<str>),1112 UnknownVariable(Rc<str>),1314 UnknownFunctionParameter(String),15 BindingParameterASecondTime(Rc<str>),16 TooManyArgsFunctionHas(usize),17 FunctionParameterNotBoundInCall(Rc<str>),1819 UndefinedExternalVariable(Rc<str>),2021 FieldMustBeStringGot(ValType),2223 AttemptedIndexAnArrayWithString(Rc<str>),24 ValueIndexMustBeTypeGot(ValType, ValType, ValType),25 CantIndexInto(ValType),2627 StandaloneSuper,2829 ImportFileNotFound(PathBuf, PathBuf),30 ResolvedFileNotFound(PathBuf),31 ImportBadFileUtf8(PathBuf),32 ImportNotSupported(PathBuf, PathBuf),33 ImportSyntaxError(jsonnet_parser::ParseError),3435 RuntimeError(Rc<str>),36 StackOverflow,37 FractionalIndex,38 DivisionByZero,39}4041#[derive(Clone, Debug)]42pub struct StackTraceElement(pub ExprLocation, pub String);43#[derive(Debug, Clone)]44pub struct StackTrace(pub Vec<StackTraceElement>);4546#[derive(Debug, Clone)]47pub struct LocError(pub Error, pub StackTrace);48pub type Result<V> = std::result::Result<V, LocError>;