You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.6 KiB
Rust
66 lines
1.6 KiB
Rust
use lavalink_rs::error::LavalinkError;
|
|
use serenity_rich_interaction::Error as SerenityUtilsError;
|
|
use thiserror::Error;
|
|
|
|
pub type BotResult<T> = Result<T, BotError>;
|
|
|
|
#[derive(Error, Debug)]
|
|
pub enum BotError {
|
|
#[error("Serenity Error: {0}")]
|
|
SerenityError(#[from] serenity::Error),
|
|
|
|
#[error("Database Error: {0}")]
|
|
Database(#[from] bot_database::error::DatabaseError),
|
|
|
|
#[error("Missing Bot Token")]
|
|
MissingToken,
|
|
|
|
#[error("Minecraft Data Error: {0}")]
|
|
MinecraftDataError(#[from] minecraft_data_rs::DataError),
|
|
|
|
#[error("IO Error: {0}")]
|
|
IOError(#[from] std::io::Error),
|
|
|
|
#[error("JSON Error: {0}")]
|
|
JsonError(#[from] serde_json::Error),
|
|
|
|
#[error("Spotify API Error: {0}")]
|
|
SpotifyError(#[from] aspotify::Error),
|
|
|
|
#[error("Reqwest Error: {0}")]
|
|
Reqwest(#[from] reqwest::Error),
|
|
|
|
#[error("Detected CLI injection attempt")]
|
|
CliInject,
|
|
|
|
#[error("Serenity Utils Error: {0}")]
|
|
SerenityUtils(#[from] serenity_rich_interaction::Error),
|
|
|
|
#[error("Track Error: {0}")]
|
|
TrackError(#[from] songbird::error::TrackError),
|
|
|
|
#[error("JoinError: {0}")]
|
|
JoinError(#[from] songbird::error::JoinError),
|
|
|
|
#[error("YouTube Error: {0}")]
|
|
YoutubeError(#[from] youtube_metadata::error::YoutubeError),
|
|
|
|
#[error("Lavalink Error: {0}")]
|
|
LavalinkError(#[from] LavalinkError),
|
|
|
|
#[error("{0}")]
|
|
Msg(String),
|
|
}
|
|
|
|
impl From<&str> for BotError {
|
|
fn from(s: &str) -> Self {
|
|
Self::Msg(s.to_string())
|
|
}
|
|
}
|
|
|
|
impl From<BotError> for SerenityUtilsError {
|
|
fn from(e: BotError) -> Self {
|
|
Self::Msg(format!("{:?}", e))
|
|
}
|
|
}
|