Skip to content

Commit

Permalink
Cleanup some error handling when sniffing what protocol you are speaking
Browse files Browse the repository at this point in the history
  • Loading branch information
AutomatedTester committed Jan 18, 2016
1 parent 38a174c commit d89ce15
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions py/selenium/webdriver/remote/errorhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,12 @@ def check_response(self, response):
import json
try:
value = json.loads(value_json)
status = value['error']
message = value['message']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]["message"]
else:
message = value.get('message', None)
except ValueError:
pass

Expand Down Expand Up @@ -147,13 +151,13 @@ def check_response(self, response):
exception_class = MoveTargetOutOfBoundsException
else:
exception_class = WebDriverException
value = response['value']
if value == '':
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
message = ''
if 'message' in value:
if message != "" and 'message' in value:
message = value['message']

screen = None
Expand Down

0 comments on commit d89ce15

Please sign in to comment.