From c0c56627c13b67d4a4d16aa18d4aeb649c562ce2 Mon Sep 17 00:00:00 2001 From: Aleksei Voronov Date: Mon, 6 Nov 2023 08:58:59 +0100 Subject: [PATCH] Add some context to profile classifier errors There's something broken with one of them atm and I'm not sure what, this will help --- src/processes/profile_classifier.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/processes/profile_classifier.rs b/src/processes/profile_classifier.rs index c54c12b..8c3d801 100644 --- a/src/processes/profile_classifier.rs +++ b/src/processes/profile_classifier.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use std::time::Duration; -use anyhow::Result; +use anyhow::{Context, Result}; use log::{error, info}; use crate::services::Bluesky; @@ -56,13 +56,15 @@ impl ProfileClassifier { } async fn fill_in_profile_details(&self, did: &str) -> Result<()> { - let details = self.bluesky.fetch_profile_details(did).await?; + let details = self.bluesky.fetch_profile_details(did).await.context("Could not fetch profile details")?; let country = match details { Some(details) => { self.ai .infer_country_of_living(&details.display_name, &details.description) - .await? + .await + .context("Could not infer country of living") + ? } None => "xx".to_owned(), };