fix(avatars): don't send image errors that aren't our fault to sentry

This commit is contained in:
alyssa 2025-03-10 15:16:32 +00:00
parent 71e8cf960c
commit e0c6839cd2

View file

@ -24,7 +24,7 @@ use std::error::Error;
use std::sync::Arc; use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use thiserror::Error; use thiserror::Error;
use tracing::{error, info}; use tracing::{error, info, warn};
use uuid::Uuid; use uuid::Uuid;
#[derive(Error, Debug)] #[derive(Error, Debug)]
@ -262,7 +262,12 @@ impl IntoResponse for PKAvatarError {
}; };
// print inner error if otherwise hidden // print inner error if otherwise hidden
error!("error: {}", self.source().unwrap_or(&self)); // `error!` calls go to sentry, so only use that if it's our error
if matches!(self, PKAvatarError::InternalError(_)) {
error!("error: {}", self.source().unwrap_or(&self));
} else {
warn!("error: {}", self.source().unwrap_or(&self));
}
( (
status_code, status_code,