fluvio_jolt/
error.rs

1use thiserror::Error as ThisError;
2use std::{result::Result as StdResult, num::ParseIntError};
3
4#[derive(Debug, ThisError)]
5pub enum Error {
6    #[error("Path index out of range when using wildcard. Index={idx};Length={len};")]
7    PathIndexOutOfRange { idx: usize, len: usize },
8    #[error("Match index out of range when using wildcard. Index={idx};Length={len};")]
9    MatchIndexOutOfRange { idx: usize, len: usize },
10    #[error("Unexpected end of right hand side expression.")]
11    UnexpectedEndOfRhs,
12    #[error("Unexpected right hand side expression.")]
13    UnexpectedRhsEntry,
14    #[error("Unexpected object in right hand side.")]
15    UnexpectedObjectInRhs,
16    #[error("Not implemented yet.")]
17    Todo,
18    #[error("Invalid index in expression.\n{0}")]
19    InvalidIndex(ParseIntError),
20    #[error("Array index out of range. Index={idx};Length={len};")]
21    ArrIndexOutOfRange { idx: usize, len: usize },
22    #[error("Json value can't be used as an index: {0:?}")]
23    InvalidIndexVal(serde_json::Value),
24    #[error("Key not found in object:{0}")]
25    KeyNotFound(String),
26    #[error("Expression didn't evaluate to a string.")]
27    EvalString,
28    #[error("Empty path while executing shift. THIS SHOULD NEVER HAPPEN.")]
29    ShiftEmptyPath,
30    #[error("Path is not empty after executing shift. THIS SHOULD NEVER HAPPEN.")]
31    ShiftPathNotEmpty,
32}
33
34pub type Result<T> = StdResult<T, Error>;