Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(bottle): Delete never-reached code #3605

Merged
merged 4 commits into from
Oct 4, 2024

Conversation

szokeasaurusrex
Copy link
Member

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. So, we do not need this code and should delete it.

szokeasaurusrex and others added 2 commits October 3, 2024 17:48
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.
Copy link

codecov bot commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.37%. Comparing base (e2aa6a5) to head (c564468).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3605      +/-   ##
==========================================
+ Coverage   84.36%   84.37%   +0.01%     
==========================================
  Files         133      133              
  Lines       13929    13927       -2     
  Branches     2938     2937       -1     
==========================================
  Hits        11751    11751              
+ Misses       1442     1441       -1     
+ Partials      736      735       -1     
Files with missing lines Coverage Δ
sentry_sdk/integrations/bottle.py 88.17% <ø> (+1.85%) ⬆️

... and 1 file with indirect coverage changes

Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thanks!

@szokeasaurusrex szokeasaurusrex enabled auto-merge (squash) October 4, 2024 08:34
@szokeasaurusrex szokeasaurusrex merged commit 033e3ad into master Oct 4, 2024
135 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/bottle-dead-code branch October 4, 2024 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants