use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum CoreError {
InvalidCursor {
reason: String,
},
FieldNotFound {
field: String,
},
Filter {
message: String,
},
Sort {
message: String,
},
Search {
message: String,
},
}
impl fmt::Display for CoreError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::InvalidCursor { reason } => write!(f, "invalid cursor: {reason}"),
Self::FieldNotFound { field } => write!(f, "field not found: {field}"),
Self::Filter { message } => write!(f, "filter error: {message}"),
Self::Sort { message } => write!(f, "sort error: {message}"),
Self::Search { message } => write!(f, "search error: {message}"),
}
}
}
impl std::error::Error for CoreError {}
pub type Result<T> = std::result::Result<T, CoreError>;