Skip to content

Commit

Permalink
clarify log message when messages not sent as encoded content
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed Jan 16, 2025
1 parent 63609c5 commit 1744eca
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions xmtp_mls/src/groups/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ use openmls::{
};
use openmls_traits::OpenMlsProvider;
use prost::Message;
use serde::{Deserialize, Serialize};
use thiserror::Error;
use tokio::sync::Mutex;
use xmtp_content_types::reaction::{LegacyReaction, ReactionCodec};
Expand Down Expand Up @@ -360,7 +359,10 @@ impl TryFrom<EncodedContent> for QueryableContentFields {
(ReactionCodec::TYPE_ID, _) => {
// Try to decode the content as UTF-8 string first
if let Ok(decoded_content) = String::from_utf8(content.content) {
tracing::info!("attempting legacy json deserialization: {}", decoded_content);
tracing::info!(
"attempting legacy json deserialization: {}",
decoded_content
);
// Try parsing as canonical JSON format first
if let Ok(reaction) = serde_json::from_str::<LegacyReaction>(&decoded_content) {
hex::decode(reaction.reference).ok()
Expand Down Expand Up @@ -786,7 +788,9 @@ impl<ScopedClient: ScopedGroupClient> MlsGroup<ScopedClient> {
fn extract_queryable_content_fields(message: &[u8]) -> QueryableContentFields {
// Return early with default if decoding fails or type is missing
EncodedContent::decode(message)
.inspect_err(|e| tracing::debug!("Failed to decode message as EncodedContent: {}", e))
.inspect_err(|_| {
tracing::debug!("No queryable content fields, msg not formatted as encoded content")
})
.and_then(|content| {
QueryableContentFields::try_from(content).inspect_err(|e| {
tracing::debug!(
Expand Down

0 comments on commit 1744eca

Please sign in to comment.