pub enum TireaError {
PathNotFound {
path: Path,
},
IndexOutOfBounds {
path: Path,
index: usize,
len: usize,
},
TypeMismatch {
path: Path,
expected: &'static str,
found: &'static str,
},
NumericOperationOnNonNumber {
path: Path,
},
MergeRequiresObject {
path: Path,
},
AppendRequiresArray {
path: Path,
},
InvalidOperation {
message: String,
},
Serialization(Error),
}Expand description
Errors that can occur during tirea-state operations.
Variants§
PathNotFound
Path does not exist in the document.
IndexOutOfBounds
Array index is out of bounds.
Fields
TypeMismatch
Type mismatch when accessing a value.
Fields
NumericOperationOnNonNumber
Numeric operation on a non-numeric value.
MergeRequiresObject
Merge operation requires an object value.
AppendRequiresArray
Append operation requires an array value.
InvalidOperation
Invalid operation error.
Serialization(Error)
JSON serialization/deserialization error.
Implementations§
Source§impl TireaError
impl TireaError
Sourcepub fn path_not_found(path: Path) -> Self
pub fn path_not_found(path: Path) -> Self
Create a path not found error.
Sourcepub fn index_out_of_bounds(path: Path, index: usize, len: usize) -> Self
pub fn index_out_of_bounds(path: Path, index: usize, len: usize) -> Self
Create an index out of bounds error.
Sourcepub fn type_mismatch(
path: Path,
expected: &'static str,
found: &'static str,
) -> Self
pub fn type_mismatch( path: Path, expected: &'static str, found: &'static str, ) -> Self
Create a type mismatch error.
Sourcepub fn numeric_on_non_number(path: Path) -> Self
pub fn numeric_on_non_number(path: Path) -> Self
Create a numeric operation on non-number error.
Sourcepub fn merge_requires_object(path: Path) -> Self
pub fn merge_requires_object(path: Path) -> Self
Create a merge requires object error.
Sourcepub fn append_requires_array(path: Path) -> Self
pub fn append_requires_array(path: Path) -> Self
Create an append requires array error.
Sourcepub fn invalid_operation(message: impl Into<String>) -> Self
pub fn invalid_operation(message: impl Into<String>) -> Self
Create an invalid operation error.
Sourcepub fn with_prefix(self, prefix: &Path) -> Self
pub fn with_prefix(self, prefix: &Path) -> Self
Add a path prefix to this error.
This is used when deserializing nested structures to maintain the full path context. For example, if a nested struct at path “address” has an error at “city”, this will combine them into “address.city”.