2020-10-16 21:30:02 +00:00
|
|
|
use crate::cofd::dice::DiceRollingError;
|
2020-10-16 12:40:25 +00:00
|
|
|
use crate::commands::CommandError;
|
|
|
|
use crate::config::ConfigError;
|
2020-10-15 16:52:08 +00:00
|
|
|
use crate::db::DataError;
|
2020-09-28 21:35:05 +00:00
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum BotError {
|
2020-10-15 16:52:08 +00:00
|
|
|
#[error("configuration error: {0}")]
|
|
|
|
ConfigurationError(#[from] ConfigError),
|
|
|
|
|
2020-09-28 21:35:05 +00:00
|
|
|
/// Sync token couldn't be found.
|
|
|
|
#[error("the sync token could not be retrieved")]
|
|
|
|
SyncTokenRequired,
|
|
|
|
|
2020-10-15 16:52:08 +00:00
|
|
|
#[error("command error: {0}")]
|
|
|
|
CommandError(#[from] CommandError),
|
|
|
|
|
|
|
|
#[error("database error: {0}")]
|
|
|
|
DataError(#[from] DataError),
|
|
|
|
|
2020-10-03 20:31:42 +00:00
|
|
|
#[error("the message should not be processed because it failed validation")]
|
|
|
|
ShouldNotProcessError,
|
|
|
|
|
2020-09-28 21:35:05 +00:00
|
|
|
#[error("no cache directory found")]
|
|
|
|
NoCacheDirectoryError,
|
|
|
|
|
|
|
|
#[error("could not parse URL")]
|
|
|
|
UrlParseError(#[from] url::ParseError),
|
|
|
|
|
|
|
|
#[error("uncategorized matrix SDK error")]
|
|
|
|
MatrixError(#[from] matrix_sdk::Error),
|
|
|
|
|
|
|
|
#[error("uncategorized matrix SDK base error")]
|
|
|
|
MatrixBaseError(#[from] matrix_sdk::BaseError),
|
|
|
|
|
|
|
|
#[error("future canceled")]
|
|
|
|
FutureCanceledError,
|
|
|
|
|
|
|
|
#[error("tokio task join error")]
|
|
|
|
TokioTaskJoinError(#[from] tokio::task::JoinError),
|
|
|
|
|
|
|
|
//de = deserialization
|
|
|
|
#[error("toml parsing error")]
|
|
|
|
TomlParsingError(#[from] toml::de::Error),
|
|
|
|
|
2020-10-15 16:52:08 +00:00
|
|
|
#[error("i/o error: {0}")]
|
2020-09-28 21:35:05 +00:00
|
|
|
IoError(#[from] std::io::Error),
|
2020-10-04 21:32:50 +00:00
|
|
|
|
2020-10-15 16:52:08 +00:00
|
|
|
#[error("actor mailbox error: {0}")]
|
|
|
|
ActixMailboxError(#[from] actix::MailboxError),
|
|
|
|
|
2020-10-04 21:32:50 +00:00
|
|
|
#[error("parsing error")]
|
|
|
|
ParserError(#[from] combine::error::StringStreamError),
|
|
|
|
|
2020-10-15 16:52:08 +00:00
|
|
|
#[error("dice parsing error: {0}")]
|
2020-10-04 21:32:50 +00:00
|
|
|
DiceParsingError(#[from] crate::cofd::parser::DiceParsingError),
|
|
|
|
|
2020-10-16 21:30:02 +00:00
|
|
|
#[error("dice pool roll error: {0}")]
|
|
|
|
DicePoolError(#[from] DiceRollingError),
|
|
|
|
|
2020-10-15 16:52:08 +00:00
|
|
|
#[error("variable parsing error: {0}")]
|
|
|
|
VariableParsingError(#[from] crate::variables::VariableParsingError),
|
|
|
|
|
2020-10-04 21:32:50 +00:00
|
|
|
#[error("legacy parsing error")]
|
|
|
|
NomParserError(nom::error::ErrorKind),
|
|
|
|
|
|
|
|
#[error("legacy parsing error: not enough data")]
|
|
|
|
NomParserIncomplete,
|
|
|
|
|
|
|
|
#[error("variables not yet supported")]
|
|
|
|
VariablesNotSupported,
|
2020-10-15 16:52:08 +00:00
|
|
|
|
|
|
|
#[error("database error")]
|
|
|
|
DatabaseErrror(#[from] sled::Error),
|
2020-09-28 21:35:05 +00:00
|
|
|
}
|