From 7c58e1512334339d5a8ca7209d04d7c65bcd21cf Mon Sep 17 00:00:00 2001 From: silverpill Date: Wed, 24 Nov 2021 18:47:55 +0000 Subject: [PATCH] Log post fetching error if it occurs during search --- src/mastodon_api/search/helpers.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mastodon_api/search/helpers.rs b/src/mastodon_api/search/helpers.rs index 30af668..d90ead9 100644 --- a/src/mastodon_api/search/helpers.rs +++ b/src/mastodon_api/search/helpers.rs @@ -83,11 +83,15 @@ async fn search_note( return Ok(None); }; let instance = config.instance(); - let maybe_post = if let Ok(object) = fetch_object(&instance, search_query).await { - let post = process_note(config, db_client, object).await?; - Some(post) - } else { - None + let maybe_post = match fetch_object(&instance, search_query).await { + Ok(object) => { + let post = process_note(config, db_client, object).await?; + Some(post) + }, + Err(err) => { + log::warn!("{}", err); + None + }, }; Ok(maybe_post) }