1use crate::ValType;2use jsonnet_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 VariableIsNotDefined(String),14 TypeMismatch(&'static str, Vec<ValType>, ValType),15 NoSuchField(Rc<str>),1617 UnknownVariable(Rc<str>),1819 OnlyFunctionsCanBeCalledGot(ValType),20 UnknownFunctionParameter(String),21 BindingParameterASecondTime(Rc<str>),22 TooManyArgsFunctionHas(usize),23 FunctionParameterNotBoundInCall(Rc<str>),2425 UndefinedExternalVariable(Rc<str>),2627 FieldMustBeStringGot(ValType),2829 AttemptedIndexAnArrayWithString(Rc<str>),30 ValueIndexMustBeTypeGot(ValType, ValType, ValType),31 CantIndexInto(ValType),3233 StandaloneSuper,3435 ImportFileNotFound(PathBuf, PathBuf),36 ResolvedFileNotFound(PathBuf),37 ImportBadFileUtf8(PathBuf),38 ImportNotSupported(PathBuf, PathBuf),39 ImportSyntaxError(jsonnet_parser::ParseError),4041 RuntimeError(Rc<str>),42 StackOverflow,43 FractionalIndex,44 DivisionByZero,45}4647#[derive(Clone, Debug)]48pub struct StackTraceElement(pub ExprLocation, pub String);49#[derive(Debug, Clone)]50pub struct StackTrace(pub Vec<StackTraceElement>);5152#[derive(Debug, Clone)]53pub struct LocError(pub Error, pub StackTrace);54pub type Result<V> = std::result::Result<V, LocError>;