1use thiserror::Error;
2
3#[derive(Error, Debug, Clone, PartialEq, Eq)]
10pub enum GateValidationError {
11 #[error("actor kind must not be empty")]
12 EmptyActorKind,
13 #[error("actor id must not be empty")]
14 EmptyActorId,
15 #[error("verb must not be empty")]
16 EmptyVerb,
17 #[error("deny reason must not be empty")]
18 EmptyDenyReason,
19 #[error("rate limit window_secs must be > 0")]
20 ZeroRateLimitWindow,
21 #[error("rate limit max must be > 0")]
22 ZeroRateLimitMax,
23}
24
25#[derive(Error, Debug)]
29pub enum GateError {
30 #[error("policy error: {0}")]
31 Policy(String),
32 #[error("evaluation error: {0}")]
33 Evaluation(String),
34 #[error("internal gate error: {0}")]
35 Internal(String),
36 #[error("validation error: {0}")]
37 Validation(#[from] GateValidationError),
38}