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
This commit is contained in:
Aleksei Voronov 2023-11-06 08:58:59 +01:00
parent 87dfb24e1a
commit c0c56627c1
1 changed files with 5 additions and 3 deletions

View File

@ -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(),
};