Skip to main content

coil_auth/live/
error.rs

1use std::error::Error;
2use std::fmt;
3
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub enum LiveAuthError {
6    ExplainApiDisabled,
7    BackendInitialization { reason: String },
8    Explain { reason: String },
9}
10
11impl fmt::Display for LiveAuthError {
12    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13        match self {
14            Self::ExplainApiDisabled => {
15                write!(f, "auth explain API is disabled by deployment config")
16            }
17            Self::BackendInitialization { reason } => {
18                write!(f, "failed to initialize the live auth backend: {reason}")
19            }
20            Self::Explain { reason } => {
21                write!(f, "failed to explain capability: {reason}")
22            }
23        }
24    }
25}
26
27impl Error for LiveAuthError {}