#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum SessionStoreError {
#[error("arcature_sessions: {source}")]
Database {
#[from]
source: sqlx::Error,
},
#[error("arcature_sessions: stored session data could not be decoded: {0}")]
Decode(String),
#[error("arcature_sessions: no unused session id after {attempts} attempts")]
IdCollision {
attempts: u32,
},
#[error("arcature_sessions: expiry {0} is outside the range this database can store")]
Expiry(String),
}
impl From<SessionStoreError> for tower_sessions::session_store::Error {
fn from(error: SessionStoreError) -> Self {
match error {
SessionStoreError::Decode(_) => Self::Decode(error.to_string()),
other => Self::Backend(other.to_string()),
}
}
}