use std::error::Error;
use std::fmt;
use crate::error::{ConstraintViolationError, InternalError};
#[derive(Debug)]
pub enum InflightOAuthRequestStoreError {
InternalError(InternalError),
ConstraintViolation(ConstraintViolationError),
}
impl Error for InflightOAuthRequestStoreError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
match self {
InflightOAuthRequestStoreError::InternalError(err) => err.source(),
InflightOAuthRequestStoreError::ConstraintViolation(err) => err.source(),
}
}
}
impl fmt::Display for InflightOAuthRequestStoreError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
InflightOAuthRequestStoreError::InternalError(err) => f.write_str(&err.to_string()),
InflightOAuthRequestStoreError::ConstraintViolation(err) => {
f.write_str(&err.to_string())
}
}
}
}
impl From<InternalError> for InflightOAuthRequestStoreError {
fn from(err: InternalError) -> Self {
InflightOAuthRequestStoreError::InternalError(err)
}
}