Skip to content

Commit 349ea35

Browse files
wackywendellEmanuele Palazzetti
authored andcommitted
[pylons] re-raise exception with original traceback
1 parent d248309 commit 349ea35

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ddtrace/contrib/pylons/middleware.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import sys
23

34
from ...ext import http
45
from ...ext import AppTypes
@@ -40,7 +41,7 @@ def _start_response(status, *args, **kwargs):
4041
return self.app(environ, _start_response)
4142
except Exception as e:
4243
# "unexpected errors"
43-
# exc_info set by __exit__ on current tracer
44+
(typ, val, tb) = sys.exc_info()
4445

4546
# e.code can either be a string or an int
4647
code = getattr(e, 'code', 500)
@@ -52,7 +53,8 @@ def _start_response(status, *args, **kwargs):
5253
code = 500
5354
span.set_tag(http.STATUS_CODE, code)
5455
span.error = 1
55-
raise e
56+
# Re-raise the original exception with its original traceback
57+
raise typ, val, tb
5658
except SystemExit:
5759
span.set_tag(http.STATUS_CODE, 500)
5860
span.error = 1

0 commit comments

Comments
 (0)