Skip to content

Commit

Permalink
fix(middleware): simplify non-functioning exception capturing
Browse files Browse the repository at this point in the history
  • Loading branch information
benedikt-budig committed Oct 14, 2021
1 parent 54f9032 commit d1bcb66
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions elastic_apm_falcon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ def process_response(self, req: Request, resp: Response, resource, req_succeeded
# the result of the transaction is the HTTP status code
transaction_result = resp.status

# if request did not succeed but has status 200, there was probably an uncaught exception
if not req_succeeded and transaction_result == HTTP_OK:
# if request did not succeed, set result to internal server error
if not req_succeeded:
transaction_result = HTTP_INTERNAL_SERVER_ERROR
self.client.capture_exception(handled=False)

# provide response data as callable (so it is only called if the request is sampled)
elasticapm.set_context(lambda: get_data_from_response(resp), "response")
Expand Down

0 comments on commit d1bcb66

Please sign in to comment.