Skip to content

Commit 89a69f5

Browse files
Nikola-3ngrujicmarcins
authored
Fix rust sentry errors having double quotes (#9732)
* some progress * map the valus to strings before passing to sentry to avoid double quoted tags * remove panic for testing --------- Co-authored-by: ngrujic <[email protected]> Co-authored-by: Marcin Szczepanski <[email protected]>
1 parent f833a24 commit 89a69f5

File tree

1 file changed

+12
-0
lines changed
  • crates/node-bindings/src/init_sentry

1 file changed

+12
-0
lines changed

crates/node-bindings/src/init_sentry/sentry.rs

+12
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ static SENTRY_GUARD: Lazy<Arc<Mutex<Option<ClientInitGuard>>>> =
1818
Lazy::new(|| Arc::new(Mutex::new(None)));
1919
const TIMEOUT: Duration = Duration::from_secs(2);
2020

21+
fn value_to_string(value: &serde_json::Value) -> String {
22+
match value {
23+
serde_json::Value::String(inner) => inner.clone(),
24+
other => other.to_string(),
25+
}
26+
}
27+
2128
#[napi]
2229
fn init_sentry() -> Result<(), Status> {
2330
if std::env::var("PARCEL_ENABLE_SENTRY").is_err() {
@@ -51,6 +58,11 @@ fn init_sentry() -> Result<(), Status> {
5158
..Default::default()
5259
};
5360

61+
let sentry_tags: HashMap<String, String> = sentry_tags
62+
.iter()
63+
.map(|(k, v)| (k.clone(), value_to_string(v)))
64+
.collect::<HashMap<String, String>>();
65+
5466
if let Some(release) = sentry_tags.get("release") {
5567
sentry_client_options.release = Some(release.to_string().into());
5668
}

0 commit comments

Comments
 (0)