Skip to content

Commit

Permalink
ref(bottle): Delete never-reached code (#3605)
Browse files Browse the repository at this point in the history
The `prepared_callback` should never raise an `HTTPResponse` exception because `prepared_callback` is already decorated by Bottle using a `@route` decorator (or a decorator for the specific HTTP methods, e.g. `@get`). This decorated function never raises `HTTPResponse`, because the `@route` wrapper [captures any `HTTPResponse` exception and converts it into the return value](https:/bottlepy/bottle/blob/cb36a7d83dc560e81dd131a365ee09db2f756a52/bottle.py#L2006-L2009). So, we do not need this code and should delete it.
  • Loading branch information
szokeasaurusrex authored Oct 4, 2024
1 parent e2aa6a5 commit 033e3ad
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions sentry_sdk/integrations/bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
Bottle,
Route,
request as bottle_request,
HTTPResponse,
__version__ as BOTTLE_VERSION,
)
except ImportError:
Expand Down Expand Up @@ -114,8 +113,6 @@ def wrapped_callback(*args, **kwargs):

try:
res = prepared_callback(*args, **kwargs)
except HTTPResponse:
raise
except Exception as exception:
event, hint = event_from_exception(
exception,
Expand Down

0 comments on commit 033e3ad

Please sign in to comment.