From a9caee5f7877887cb2253df5de6cc0c9ec63cc84 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 3 Aug 2022 10:03:25 -0500 Subject: [PATCH] Finish span on error as well --- lib/patches_for_sentry.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/patches_for_sentry.rb b/lib/patches_for_sentry.rb index 48ff7c3312af2c0af338b0e5e29622933601cf16..93a556c78325b4402ee5fdd75568837ba38d1fa2 100644 --- a/lib/patches_for_sentry.rb +++ b/lib/patches_for_sentry.rb @@ -63,12 +63,13 @@ module SentryIQManager transaction = Sentry.get_current_scope.get_transaction return yield unless transaction&.sampled - span = transaction.start_child( - op: "xmpp.iq", - description: description - ) + span = transaction.start_child(op: "xmpp.iq", description: description) - yield.then { span.finish } + yield.then { span.finish }.catch do |e| + span.set_status("internal_error") + span.finish + EMPromise.reject(e) + end end def stanza_description(stanza)