cala_cel_interpreter/
error.rs1use chrono::ParseError;
2use thiserror::Error;
3
4use crate::cel_type::*;
5
6#[derive(Error, Debug)]
7pub enum ResultCoercionError {
8 #[error("Error evaluating expression '{0}' - Could not coerce {1:?} into {2:?}")]
9 BadCoreTypeCoercion(String, CelType, CelType),
10 #[error("Error evaluating expression '{0}' - Could not coerce {1:?} into {2:?}")]
11 BadExternalTypeCoercion(String, CelType, &'static str),
12 #[error("Error evaluating expression '{0}' - Could not coerce {1:?} into {2:?} - Reason: {3}")]
13 ExternalTypeCoercionError(String, String, &'static str, String),
14}
15
16#[derive(Error, Debug)]
17pub enum CelError {
18 #[error("CelError - CelParseError: {0}")]
19 CelParseError(String),
20 #[error("CelError - BadType: expected {0:?} found {1:?}")]
21 BadType(CelType, CelType),
22 #[error("CelError - UnknownIdentifier: {0}")]
23 UnknownIdent(String),
24 #[error("CelError - UnknownPackage: No package installed for type '{0}'")]
25 UnknownPackage(&'static str),
26 #[error("CelError - UnknownAttribute: No attribute '{1}' on type {0:?}")]
27 UnknownAttribute(CelType, String),
28 #[error("CelError - IllegalTarget")]
29 IllegalTarget,
30 #[error("CelError - MissingArgument")]
31 MissingArgument,
32 #[error("CelError - WrongArgumentType: {0:?} instead of {1:?}")]
33 WrongArgumentType(CelType, CelType),
34 #[error("CelError - ChronoParseError: {0}")]
35 ChronoParseError(#[from] ParseError),
36 #[error("CelError - UuidError: {0}")]
37 UuidError(String),
38 #[error("CelError - DecimalError: {0}")]
39 DecimalError(String),
40 #[error("CelError - TimestampError: {0}")]
41 TimestampError(String),
42 #[error("CelError - NoMatchingOverload: {0}")]
43 NoMatchingOverload(String),
44 #[error("CelError - Unexpected: {0}")]
45 Unexpected(String),
46
47 #[error("CelError - {0}")]
48 ResultCoercionError(#[from] ResultCoercionError),
49
50 #[error("Error evaluating cell expression '{0}' - {1}")]
51 EvaluationError(String, Box<Self>),
52}