1use thiserror::Error;
2
3#[derive(Error, Debug, Clone, PartialEq, Eq)]
8pub enum GateValidationError {
9 #[error("actor kind must not be empty")]
10 EmptyActorKind,
11 #[error("actor id must not be empty")]
12 EmptyActorId,
13 #[error("verb must not be empty")]
14 EmptyVerb,
15 #[error("deny reason must not be empty")]
16 EmptyDenyReason,
17 #[error("audit tag must not be empty")]
18 EmptyAuditTag,
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)]
27pub enum GateError {
28 #[error("policy error: {0}")]
29 Policy(String),
30 #[error("internal gate error: {0}")]
31 Internal(String),
32 #[error("validation error: {0}")]
33 Validation(#[from] GateValidationError),
34}