1use thiserror::Error;
4
5#[derive(Error, Debug, Clone)]
7pub enum AuthzError {
8 #[error("validation: {field} — {message}")]
10 Validation { field: String, message: String },
11
12 #[error("model parse error: {0}")]
14 ModelParse(String),
15
16 #[error("model validation: {0}")]
17 ModelValidation(String),
18
19 #[error("no authorization model found")]
20 ModelNotFound,
21
22 #[error("relationship validation: {0}")]
24 RelationshipValidation(String),
25
26 #[error("relation '{relation}' not found on type '{object_type}'")]
28 RelationNotFound {
29 object_type: String,
30 relation: String,
31 },
32
33 #[error("max recursion depth exceeded")]
34 MaxDepthExceeded,
35
36 #[error("resolution failed: {0}")]
37 ResolutionError(String),
38
39 #[error("datastore error: {0}")]
41 Datastore(String),
42
43 #[error("cache lock poisoned")]
44 CachePoisoned,
45
46 #[error("internal error: {0}")]
48 Internal(String),
49}