Bug 1461463 - [wdclient] "message" argument of WebDriverException has to be optional.
MozReview-Commit-ID: 3atuW15tUOa
--- a/testing/web-platform/tests/tools/webdriver/webdriver/error.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/error.py
@@ -1,31 +1,34 @@
import collections
import json
class WebDriverException(Exception):
http_status = None
status_code = None
- def __init__(self, message, stacktrace=None):
+ def __init__(self, message=None, stacktrace=None):
super(WebDriverException, self)
self.message = message
self.stacktrace = stacktrace
def __repr__(self):
return "<%s http_status=%s>" % (self.__class__.__name__, self.http_status)
def __str__(self):
- message = "%s (%s): %s\n" % (self.status_code, self.http_status, self.message)
+ message = "%s (%s)" % (self.status_code, self.http_status)
+
+ if self.message is not None:
+ message += ": %s" % self.message
+ message += "\n"
+
if self.stacktrace:
- message += ("\n"
- "Remote-end stacktrace:\n"
- "\n"
- "%s" % self.stacktrace)
+ message += ("\nRemote-end stacktrace:\n\n%s" % self.stacktrace)
+
return message
class ElementClickInterceptedException(WebDriverException):
http_status = 400
status_code = "element click intercepted"