From 1ebf888085c10aa7ea6a544e74df0b10f845223b Mon Sep 17 00:00:00 2001 From: xffxff <1247714429@qq.com> Date: Thu, 15 Jun 2023 06:27:45 +0800 Subject: [PATCH] log the error from engines --- src/search_results_handler/aggregator.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/search_results_handler/aggregator.rs b/src/search_results_handler/aggregator.rs index 8b6bae3..cba266c 100644 --- a/src/search_results_handler/aggregator.rs +++ b/src/search_results_handler/aggregator.rs @@ -58,8 +58,19 @@ pub async fn aggregate( searx::results(query, page, &user_agent) ); - let ddg_map_results: HashMap = ddg_map_results?; - let searx_map_results: HashMap = searx_map_results?; + let ddg_map_results = ddg_map_results.unwrap_or_else(|e| { + if debug { + log::error!("Error fetching results from DuckDuckGo: {:?}", e); + } + HashMap::new() + }); + + let searx_map_results = searx_map_results.unwrap_or_else(|e| { + if debug { + log::error!("Error fetching results from Searx: {:?}", e); + } + HashMap::new() + }); result_map.extend(ddg_map_results);