Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

feat: handle JSONResponse errors like provisioned errors #892

Merged
merged 1 commit into from
May 11, 2017

Conversation

bbangert
Copy link
Member

When handling provisioned errors, the same logic should be used as when
a JSONResponseError occurs.

Closes #744

@codecov-io
Copy link

codecov-io commented May 11, 2017

Codecov Report

Merging #892 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #892   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          54     54           
  Lines        9782   9780    -2     
=====================================
- Hits         9782   9780    -2
Impacted Files Coverage Δ
autopush/router/simple.py 100% <100%> (ø) ⬆️
autopush/tests/test_websocket.py 100% <100%> (ø) ⬆️
autopush/websocket.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2776922...b70a47f. Read the comment docs.

@@ -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)
Copy link
Member

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

@@ -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):
Copy link
Member

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
Copy link
Member

@jrconlin jrconlin left a 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?

@bbangert
Copy link
Member Author

Yup, as @pjenvey pointed out.

@jrconlin
Copy link
Member

Apparently it is.

@bbangert bbangert merged commit 40b45bc into master May 11, 2017
@bbangert bbangert deleted the feat/issue-744 branch May 11, 2017 21:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants