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:
2025-06-22 16:26:27 +02:00
parent 39ff5f01e7
commit 2f33b41359
16 changed files with 74 additions and 109 deletions

View File

@@ -40,7 +40,7 @@ async fn generic_search_pagination_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 chat_id = cq.chat_id();
let user_id = cq.from.id;
@@ -106,11 +106,11 @@ where
};
}
let formated_page = items_page.format(page, 4096);
let formatted_page = items_page.format(page, 4096);
let keyboard = generic_get_pagination_keyboard(page, items_page.pages, search_data, true);
bot.edit_message_text(chat_id, message_id, formated_page)
bot.edit_message_text(chat_id, message_id, formatted_page)
.reply_markup(keyboard)
.send()
.await?;