-
Notifications
You must be signed in to change notification settings - Fork 30
feat: handle JSONResponse errors like provisioned errors #892
Conversation
Codecov Report
@@ Coverage Diff @@
## master #892 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 54 54
Lines 9782 9780 -2
=====================================
- Hits 9782 9780 -2
Continue to review full report at Codecov.
|
autopush/web/base.py
Outdated
@@ -236,7 +236,7 @@ def _overload_err(self, fail): | |||
|
|||
def _boto_err(self, fail): | |||
"""errBack for random boto exceptions""" | |||
fail.trap(BotoServerError) | |||
fail.trap(BotoServerError, JSONResponseError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed: JSONResponse is a BotoServerError subclass
autopush/router/simple.py
Outdated
@@ -107,8 +108,8 @@ def route_notification(self, notification, uaid_data): | |||
if result is False: | |||
self.metrics.increment("router.broadcast.miss") | |||
returnValue(self.stored_response(notification)) | |||
except ProvisionedThroughputExceededException: | |||
raise RouterException("Provisioned throughput error", | |||
except (ProvisionedThroughputExceededException, JSONResponseError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
turns out ProvisionedThroughputExceededException is a subclass of JSONResponseError: so you could just catch that one
When handling provisioned errors, the same logic should be used as when a JSONResponseError occurs. Closes #744
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take it ProvisionedThroughputExceededException is a subclass of JSONResponseError?
Yup, as @pjenvey pointed out. |
Apparently it is. |
When handling provisioned errors, the same logic should be used as when
a JSONResponseError occurs.
Closes #744