Skip to content

Commit

Permalink
Added new case for 449
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaditya Sharma committed Jun 10, 2019
1 parent cf452bd commit e90918f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion qds_sdk/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,14 @@ def _handle_error(response):
elif code == 422:
sys.stderr.write(response.text + "\n")
raise ResourceInvalid(response)
elif code in (449, 502, 503, 504):
elif code in (502, 503, 504):
sys.stderr.write(response.text + "\n")
raise RetryWithDelay(response)
elif code == 449:
message = "Data requested is unavailable. Retrying ..."
sys.stderr.write(response.text + "\n")
sys.stderr.write(message + "\n")
raise RetryWithDelay(response, message)
elif 401 <= code < 500:
sys.stderr.write(response.text + "\n")
raise ClientError(response)
Expand Down
7 changes: 5 additions & 2 deletions qds_sdk/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ def __init__(self, message, usage):
class Error(Exception):
"""A general error derived from Exception."""

def __init__(self, request):
Exception.__init__(self, request.text)
def __init__(self, request, message = ""):
response = request.text
if message:
response = message
Exception.__init__(self, response)
self.request = request


Expand Down

0 comments on commit e90918f

Please sign in to comment.