Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c6ad235

Browse files
authored
Set internal_error span status on span context manager exit (#3642)
1 parent 74cb7db commit c6ad235

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sentry_sdk/tracing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,8 +1273,10 @@ def __enter__(self):
12731273

12741274
def __exit__(self, ty, value, tb):
12751275
# type: (Optional[Any], Optional[Any], Optional[Any]) -> None
1276+
if value is not None:
1277+
self.set_status(SPANSTATUS.INTERNAL_ERROR)
1278+
12761279
self.finish()
1277-
# XXX set status to error if unset and an exception occurred?
12781280
context.detach(self._ctx_token)
12791281

12801282
def _get_attribute(self, name):

0 commit comments

Comments
 (0)