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("audit tag must not be empty")]
20 EmptyAuditTag,
21 #[error("rate limit window_secs must be > 0")]
22 ZeroRateLimitWindow,
23 #[error("rate limit max must be > 0")]
24 ZeroRateLimitMax,
25}
26
27#[derive(Error, Debug)]
31pub enum GateError {
32 #[error("policy error: {0}")]
33 Policy(String),
34 #[error("internal gate error: {0}")]
35 Internal(String),
36 #[error("validation error: {0}")]
37 Validation(#[from] GateValidationError),
38}