Skip to content

Commit

Permalink
Modified get method to raise errors only when unknown errors occurs (…
Browse files Browse the repository at this point in the history
…other than HTTP error and url open error
  • Loading branch information
rohandudam committed Mar 12, 2018
1 parent 87bbd36 commit a84bd12
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions endpoints/Base_Mechanize.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ def get(self, url, headers={}):
(url, error_message))
elif (e.reason.args[0] == 10061):
print "\033[1;31m\nURL open error: Please check if the API server is up or there is any other issue accessing the URL\033[1;m"
raise e
else:
print(e.reason.args)
# bubble error back up after printing relevant details
raise e
# bubble error back up after printing relevant details
raise e # We raise error only when unknown errors occurs (other than HTTP error and url open error 10061)

return {'response': response, 'error': error}

Expand All @@ -69,7 +70,6 @@ def post(self, url, data=None, headers={}):
else:
print(e.reason.args)
# bubble error back up after printing relevant details

raise e

return {'response': response, 'error': error}
Expand Down

0 comments on commit a84bd12

Please sign in to comment.