Skip to main content

potree_auth/authentication/application/
error.rs

1use super::super::ports::authentication_engine::AuthenticationEngineError;
2
3#[derive(Debug, Clone, thiserror::Error)]
4pub enum AuthenticationServiceError {
5    #[error("unable to set up infrastructure: {message}")]
6    Infrastructure { message: String },
7
8    #[error("unable exchange information with the IdP: {message}")]
9    IdpExchange { message: String },
10
11    #[error("unable to validate IdP data: {message}")]
12    Validation { message: String },
13}
14
15impl From<AuthenticationEngineError> for AuthenticationServiceError {
16    fn from(value: AuthenticationEngineError) -> Self {
17        match value {
18            AuthenticationEngineError::Infrastructure { message } => {
19                Self::Infrastructure { message }
20            }
21            AuthenticationEngineError::IdpExchange { message } => Self::IdpExchange { message },
22            AuthenticationEngineError::Validation { message } => Self::Validation { message },
23        }
24    }
25}