mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 15:35:35 +01:00
Refactor error handling to use anyhow throughout codebase
Switch all custom error types and handler signatures from `Box<dyn std::error::Error + Send + Sync>` to `anyhow::Result`. Add anyhow as a dependency. Fix typos and update function names for consistency.
This commit is contained in:
@@ -39,7 +39,7 @@ async fn send_book_handler<T, P, Fut>(
|
||||
where
|
||||
T: Format + Clone + Debug,
|
||||
P: FormatTitle + Clone + Debug,
|
||||
Fut: std::future::Future<Output = Result<Page<T, P>, Box<dyn std::error::Error + Send + Sync>>>,
|
||||
Fut: std::future::Future<Output = anyhow::Result<Page<T, P>>>,
|
||||
{
|
||||
let id = match command {
|
||||
BookCommand::Author { id } => id,
|
||||
@@ -59,7 +59,7 @@ where
|
||||
.await
|
||||
{
|
||||
Ok(_) => Ok(()),
|
||||
Err(err) => Err(Box::new(err)),
|
||||
Err(err) => Err(err.into()),
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -110,7 +110,7 @@ async fn send_pagination_book_handler<T, P, Fut>(
|
||||
where
|
||||
T: Format + Clone + Debug,
|
||||
P: FormatTitle + Clone + Debug,
|
||||
Fut: std::future::Future<Output = Result<Page<T, P>, Box<dyn std::error::Error + Send + Sync>>>,
|
||||
Fut: std::future::Future<Output = anyhow::Result<Page<T, P>>>,
|
||||
{
|
||||
let (id, page) = match callback_data {
|
||||
BookCallbackData::Author { id, page } => (id, page),
|
||||
|
||||
Reference in New Issue
Block a user