ic_response_verification/cel/
error.rs1pub(crate) type CelParserResult<T = ()> = Result<T, CelParserError>;
2
3#[derive(thiserror::Error, Debug, Clone)]
5pub enum CelParserError {
6 #[error(r#""{0}" is not a supported CEL function, only default_certification is currently supported"#)]
8 UnrecognizedFunction(String),
9
10 #[error(r#"Parameter at position {parameter_position:?} for function {function_name:?} is missing, expected {parameter_name:?} with type {parameter_type:?}"#)]
12 MissingFunctionParameter {
13 function_name: String,
15 parameter_type: String,
17 parameter_name: String,
19 parameter_position: u8,
21 },
22
23 #[error(r#"Parameter at position {parameter_position:?} for function {function_name:?} has the wrong type, expected {parameter_name:?} {expected_parameter_type:?} found {found_parameter_type:?}"#)]
25 IncorrectFunctionParameterType {
26 function_name: String,
28 parameter_name: String,
30 expected_parameter_type: String,
32 found_parameter_type: String,
34 parameter_position: u8,
36 },
37
38 #[error(r#"Expected node with name {node_name:?} to have type {expected_type:?}, found {found_type:?}"#)]
40 UnexpectedNodeType {
41 node_name: String,
43 expected_type: String,
45 found_type: String,
47 },
48
49 #[error(r#"Expected node with type {node_type:?} to have name {expected_name:?}, found {found_name:?}"#)]
51 UnexpectedNodeName {
52 node_type: String,
54 expected_name: String,
56 found_name: String,
58 },
59
60 #[error(r#"Expected object {object_name:?} to have property {expected_property_name:?}"#)]
62 MissingObjectProperty {
63 object_name: String,
65 expected_property_name: String,
67 },
68
69 #[error(r#"The request_certification object must only specify one of the no_request_certification or request_certification properties, not both"#)]
71 ExtraneousRequestCertificationProperty,
72
73 #[error(r#"The request_certification object must specify at least one of the no_request_certification or request_certification properties"#)]
75 MissingRequestCertificationProperty,
76
77 #[error(r#"The response_certification object must only specify one of the certified_response_headers or response_header_exclusions properties, not both"#)]
79 ExtraneousResponseCertificationProperty,
80
81 #[error(r#"The response_certification object must specify at least one of the certified_response_headers or response_header_exclusions properties"#)]
83 MissingResponseCertificationProperty,
84
85 #[error(r#"The ValidationArgs parameter must only specify one of the no_certification or certification properties, not both"#)]
87 ExtraneousValidationArgsProperty,
88
89 #[error(r#"The ValidationArgs parameter must specify at least one of the no_certification or certification properties"#)]
91 MissingValidationArgsProperty,
92
93 #[error(r#"Cel Syntax Expception: {0}"#)]
95 CelSyntaxException(String),
96}