mirror of
https://github.com/kristoferssolo/tg-relay-rs.git
synced 2026-02-25 05:08:15 +00:00
test: add tests
This commit is contained in:
14
src/error.rs
14
src/error.rs
@@ -17,12 +17,21 @@ pub enum Error {
|
||||
#[error("unknown media kind")]
|
||||
UnknownMediaKind,
|
||||
|
||||
#[error("validation failed: {0}")]
|
||||
ValidationFailed(String),
|
||||
|
||||
#[error("teloxide error: {0}")]
|
||||
Teloxide(#[from] teloxide::RequestError),
|
||||
|
||||
#[error("join error: {0}")]
|
||||
Join(#[from] tokio::task::JoinError),
|
||||
|
||||
#[error("rate limit exceeded")]
|
||||
RateLimit,
|
||||
|
||||
#[error("")]
|
||||
QuoteError(#[from] shlex::QuoteError),
|
||||
|
||||
#[error("other: {0}")]
|
||||
Other(String),
|
||||
}
|
||||
@@ -42,6 +51,11 @@ impl Error {
|
||||
pub fn ytdlp_failed(text: impl Into<String>) -> Self {
|
||||
Self::YTDLPFailed(text.into())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn validation_falied(text: impl Into<String>) -> Self {
|
||||
Self::ValidationFailed(text.into())
|
||||
}
|
||||
}
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
Reference in New Issue
Block a user