1use std::error::Error;
2use std::fmt::Display;
3
4use crate::Path;
5
6#[derive(Debug, Clone, PartialEq, Eq)]
8#[non_exhaustive]
9pub enum MutationError {
10 IndexError { path: Path<false> },
12 OperationError { path: Path<false> },
14}
15
16impl Display for MutationError {
17 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18 match self {
19 Self::IndexError { path } => {
20 write!(f, "path {path} does not exist or is malformed")
21 }
22 Self::OperationError { path } => {
23 write!(f, "operation could not be performed at {path}")
24 }
25 }
26 }
27}
28
29impl Error for MutationError {}