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(rules): Raise exception on keyerror #70880

Merged

Conversation

ceorourke
Copy link
Member

Follow up from #70831 (comment) to make this raise an exception rather than just log an error.

@ceorourke ceorourke requested a review from saponifi3d May 14, 2024 18:48
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label May 14, 2024
Copy link
Contributor

@saponifi3d saponifi3d left a comment

Choose a reason for hiding this comment

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

TIL that this will also automatically use the exception. 🔥

Copy link

codecov bot commented May 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 80.01%. Comparing base (1f61c87) to head (51592d6).
Report is 13 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #70880       +/-   ##
===========================================
+ Coverage   63.16%   80.01%   +16.84%     
===========================================
  Files        6501     6506        +5     
  Lines      290600   290891      +291     
  Branches    50105    50133       +28     
===========================================
+ Hits       183554   232743    +49189     
+ Misses     106606    57714    -48892     
+ Partials      440      434        -6     
Files Coverage Δ
src/sentry/buffer/redis.py 92.05% <0.00%> (+60.03%) ⬆️

... and 1776 files with indirect coverage changes

@ceorourke ceorourke merged commit 255c94c into master May 14, 2024
49 of 50 checks passed
@ceorourke ceorourke deleted the ceorourke/redisbufferhookregistrykeyerror-exception branch May 14, 2024 19:25
@gmisiolek-sbm
Copy link

gmisiolek-sbm commented May 21, 2024

After this change there are errors:

worker-1                                        | Traceback (most recent call last):
worker-1                                        |   File "/usr/local/lib/python3.11/site-packages/sentry/buffer/redis.py", line 74, in callback
worker-1                                        |     callback = self._registry[buffer_hook_event]
worker-1                                        |                ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
worker-1                                        | KeyError: <BufferHookEvent.FLUSH: 'flush'>
worker-1                                        | 22:11:00 [ERROR] sentry.buffer.redis: buffer_hook_event.missing
worker-1                                        | Traceback (most recent call last):
worker-1                                        |   File "/usr/local/lib/python3.11/site-packages/sentry/buffer/redis.py", line 313, in process_batch
worker-1                                        |     redis_buffer_registry.callback(BufferHookEvent.FLUSH, self)
worker-1                                        |   File "/usr/local/lib/python3.11/site-packages/sentry/buffer/redis.py", line 78, in callback
worker-1                                        |     return callback(data)
worker-1                                        |            ^^^^^^^^
worker-1                                        | UnboundLocalError: cannot access local variable 'callback' where it is not associated with a value

why return has been removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants