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 NoSuchField(Rc<str>),1011 UnknownVariable(Rc<str>),1213 UnknownFunctionParameter(String),14 BindingParameterASecondTime(Rc<str>),15 TooManyArgsFunctionHas(usize),16 FunctionParameterNotBoundInCall(Rc<str>),1718 UndefinedExternalVariable(Rc<str>),1920 FieldMustBeStringGot(ValType),2122 AttemptedIndexAnArrayWithString(Rc<str>),23 ValueIndexMustBeTypeGot(ValType, ValType, ValType),24 CantIndexInto(ValType),2526 StandaloneSuper,2728 ImportFileNotFound(PathBuf, PathBuf),29 ResolvedFileNotFound(PathBuf),30 ImportBadFileUtf8(PathBuf),31 ImportNotSupported(PathBuf, PathBuf),32 ImportSyntaxError(jsonnet_parser::ParseError),3334 RuntimeError(Rc<str>),35 StackOverflow,36 FractionalIndex,37 DivisionByZero,38}3940#[derive(Clone, Debug)]41pub struct StackTraceElement(pub ExprLocation, pub String);42#[derive(Debug, Clone)]43pub struct StackTrace(pub Vec<StackTraceElement>);4445#[derive(Debug, Clone)]46pub struct LocError(pub Error, pub StackTrace);47pub type Result<V> = std::result::Result<V, LocError>;