hessra_cap_engine/
error.rs1use crate::types::{ExposureLabel, ObjectId, Operation};
4use thiserror::Error;
5
6#[derive(Error, Debug)]
8pub enum EngineError {
9 #[error("capability denied: {subject} cannot perform '{operation}' on '{target}': {reason}")]
11 CapabilityDenied {
12 subject: ObjectId,
13 target: ObjectId,
14 operation: Operation,
15 reason: String,
16 },
17
18 #[error("capability denied by exposure: label '{label}' blocks access to '{target}'")]
20 ExposureRestriction {
21 label: ExposureLabel,
22 target: ObjectId,
23 },
24
25 #[error("identity error: {0}")]
27 Identity(String),
28
29 #[error("context error: {0}")]
31 Context(String),
32
33 #[error("token error: {0}")]
35 Token(#[from] hessra_token_core::TokenError),
36
37 #[error("token operation failed: {0}")]
39 TokenOperation(String),
40
41 #[error("policy error: {0}")]
43 Policy(String),
44}