1pub type StoreError = Box<dyn std::error::Error + Send + Sync + 'static>;
5
6#[derive(Debug, thiserror::Error)]
9#[non_exhaustive]
10pub enum GuardError {
11 #[error("session store error: {0}")]
13 Store(#[from] StoreError),
14 #[error("operating system random number generator unavailable")]
16 Random,
17 #[error("subject could not be serialized: {0}")]
19 Subject(String),
20}
21
22#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
24#[non_exhaustive]
25pub enum ConfigError {
26 #[error("invalid trusted proxy {0:?}: expected an IP address or CIDR range")]
28 InvalidProxy(String),
29 #[error("invalid cookie configuration: {0}")]
31 InvalidCookie(&'static str),
32 #[error("invalid duration for {0}: must be greater than zero and fit in a timestamp")]
34 InvalidDuration(&'static str),
35 #[error("rotation grace must be shorter than the rotation interval")]
37 GraceTooLong,
38 #[error("thresholds must satisfy 0 < step_up <= revoke")]
40 InvalidThresholds,
41 #[error("invalid header name {0:?}")]
43 InvalidHeaderName(String),
44 #[error("invalid token prefix {0:?}: expected 1 to 32 characters of A-Z a-z 0-9 _ -")]
46 InvalidTokenPrefix(String),
47}