Skip to content

Commit 9814dfc

Browse files
goffrieConvex, Inc.
authored andcommitted
Log Sentry event_id from report_error (#34873)
GitOrigin-RevId: 2a7971c5774b2062488733d768b5a03b611684f7
1 parent 087ddc0 commit 9814dfc

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

crates/common/src/errors.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,22 +162,25 @@ pub fn report_error_sync(err: &mut anyhow::Error) {
162162
return;
163163
}
164164

165-
if sentry_client.is_enabled() {
166-
tracing::error!("Reporting above error to sentry.");
167-
} else {
165+
if !sentry_client.is_enabled() {
168166
tracing::error!("Not reporting above error: SENTRY_DSN not set.");
167+
return;
169168
}
170169

171-
sentry::with_scope(
170+
let event_id = sentry::with_scope(
172171
|scope| {
173172
scope.set_level(Some(level));
174173
scope.set_tag("short_msg", err.short_msg());
175174
},
176175
|| {
177176
#[allow(clippy::disallowed_methods)]
178-
sentry::integrations::anyhow::capture_anyhow(err);
177+
sentry::integrations::anyhow::capture_anyhow(err)
179178
},
180179
);
180+
tracing::error!(
181+
"Reporting above error to sentry with event_id {}",
182+
event_id.simple()
183+
);
181184
} else {
182185
tracing::error!("Not reporting above error to sentry.");
183186
}

0 commit comments

Comments
 (0)