35 lines
669 B
Rust
35 lines
669 B
Rust
use thiserror::Error;
|
|
|
|
#[derive(Error, Debug)]
|
|
pub enum RoomError {
|
|
#[error("Database error: {0}")]
|
|
Database(#[from] sea_orm::DbErr),
|
|
|
|
#[error("Not found: {0}")]
|
|
NotFound(String),
|
|
|
|
#[error("Unauthorized")]
|
|
Unauthorized,
|
|
|
|
#[error("No power / permission denied")]
|
|
NoPower,
|
|
|
|
#[error("Rate limited: {0}")]
|
|
RateLimited(String),
|
|
|
|
#[error("Bad request: {0}")]
|
|
BadRequest(String),
|
|
|
|
#[error("Role parse error")]
|
|
RoleParseError,
|
|
|
|
#[error("Internal error: {0}")]
|
|
Internal(String),
|
|
}
|
|
|
|
impl From<anyhow::Error> for RoomError {
|
|
fn from(e: anyhow::Error) -> Self {
|
|
RoomError::Internal(e.to_string())
|
|
}
|
|
}
|