test: add tests

This commit is contained in:
2025-09-22 11:18:36 +03:00
parent 248fe97991
commit dd3b2b618b
9 changed files with 331 additions and 85 deletions

View File

@@ -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>;