Skip to content

Commit c2fc945

Browse files
authored
record_exception: Accept BaseException (#3354)
1 parent 29c293f commit c2fc945

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
([#3648](https://github.com/open-telemetry/opentelemetry-python/pull/3648))
1818
- Fix ValueError message for PeriodicExportingMetricsReader
1919
([#3769](https://github.com/open-telemetry/opentelemetry-python/pull/3769))
20+
- Use `BaseException` instead of `Exception` in `record_exception`
21+
([#3354](https://github.com/open-telemetry/opentelemetry-python/pull/3354))
2022
- Make span.record_exception more robust
2123
([#3778](https://github.com/open-telemetry/opentelemetry-python/pull/3778))
2224
- Fix license field in pyproject.toml files

opentelemetry-api/src/opentelemetry/trace/span.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def set_status(
169169
@abc.abstractmethod
170170
def record_exception(
171171
self,
172-
exception: Exception,
172+
exception: BaseException,
173173
attributes: types.Attributes = None,
174174
timestamp: typing.Optional[int] = None,
175175
escaped: bool = False,
@@ -563,7 +563,7 @@ def set_status(
563563

564564
def record_exception(
565565
self,
566-
exception: Exception,
566+
exception: BaseException,
567567
attributes: types.Attributes = None,
568568
timestamp: typing.Optional[int] = None,
569569
escaped: bool = False,

opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ def __exit__(
983983

984984
def record_exception(
985985
self,
986-
exception: Exception,
986+
exception: BaseException,
987987
attributes: types.Attributes = None,
988988
timestamp: Optional[int] = None,
989989
escaped: bool = False,

0 commit comments

Comments
 (0)