Skip to content

Commit

Permalink
Ignore internal metadata fields with the wrong type
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Jan 5, 2024
1 parent b8dd676 commit f1351d4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rust/src/events/internal_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use std::{num::NonZeroI64, ops::Deref};

use anyhow::Context;
use log::warn;
use pyo3::{
exceptions::PyAttributeError, pyclass, pymethods, types::PyDict, IntoPy, PyAny, PyObject,
PyResult, Python,
Expand Down Expand Up @@ -197,8 +198,12 @@ impl EventInternalMetadata {
let mut data = Vec::with_capacity(dict.len());

for (key, value) in dict.iter() {
if let Some(entry) = EventInternalMetadataData::from_python_pair(key, value)? {
data.push(entry);
match EventInternalMetadataData::from_python_pair(key, value) {
Ok(Some(entry)) => data.push(entry),
Ok(None) => {}
Err(err) => {
warn!("Ignoring internal metadata field '{key}', as failed to convert to Rust due to {err}")
}
}
}

Expand Down

0 comments on commit f1351d4

Please sign in to comment.