use thiserror::Error;
#[derive(Error, Debug, Clone)]
pub enum AuthzError {
#[error("validation: {field} — {message}")]
Validation { field: String, message: String },
#[error("model parse error: {0}")]
ModelParse(String),
#[error("model validation: {0}")]
ModelValidation(String),
#[error("no authorization model found")]
ModelNotFound,
#[error("relationship validation: {0}")]
RelationshipValidation(String),
#[error("relation '{relation}' not found on type '{object_type}'")]
RelationNotFound {
object_type: String,
relation: String,
},
#[error("max recursion depth exceeded")]
MaxDepthExceeded,
#[error("resolution failed: {0}")]
ResolutionError(String),
#[error("datastore error: {0}")]
Datastore(String),
#[error("cache lock poisoned")]
CachePoisoned,
#[error("internal error: {0}")]
Internal(String),
}