File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -590,7 +590,7 @@ def use_span(
590590 finally :
591591 context_api .detach (token )
592592
593- except Exception as exc : # pylint: disable=broad-exception-caught
593+ except BaseException as exc : # pylint: disable=broad-exception-caught
594594 if isinstance (span , Span ) and span .is_recording ():
595595 # Record the exception as an event
596596 if record_exception :
Original file line number Diff line number Diff line change @@ -133,6 +133,18 @@ class TestUseSpanException(Exception):
133133
134134 self .assertEqual (test_span .recorded_exception , exception )
135135
136+ def test_use_span_base_exception (self ):
137+ class TestUseSpanBaseException (BaseException ):
138+ pass
139+
140+ test_span = SpanTest (trace .INVALID_SPAN_CONTEXT )
141+ exception = TestUseSpanBaseException ("test exception" )
142+ with self .assertRaises (TestUseSpanBaseException ):
143+ with trace .use_span (test_span ):
144+ raise exception
145+
146+ self .assertEqual (test_span .recorded_exception , exception )
147+
136148 def test_use_span_set_status (self ):
137149 class TestUseSpanException (Exception ):
138150 pass
You can’t perform that action at this time.
0 commit comments