Bug 1413326 - Discard stacktraces of WebDriver errors in response. r?whimboo draft
authorAndreas Tolfsen <ato@sny.no>
Wed, 17 Jan 2018 14:19:24 +0000
changeset 721591 81bce4779be2feca70ace6a1a616b0c7dc042e6b
parent 721495 4e429d313fd2e0f9202271ee8f3fb798817ec3e7
child 746376 93baac10756396829fcabe3294e9232d77802fde
push id95882
push userbmo:ato@sny.no
push dateWed, 17 Jan 2018 14:25:05 +0000
reviewerswhimboo
bugs1413326
milestone59.0a1
Bug 1413326 - Discard stacktraces of WebDriver errors in response. r?whimboo This patch changes Marionette to discard stacktraces from errors that extends the WebDriverError prototype. This has the effect that programming errors (such as TypeError, RangeError, et al.) will be sent with a stacktrace because WebDriver related errors are considered "expected". When Marionette returns with an element not found error, this is intended behaviour and a stacktrace is of extremely limited value. Indeed, including the stacktrace might mislead users to think that the returned error is an implementation problem in the driver. Programming errors will also be logged in full through error.report in stdout, as usual. MozReview-Commit-ID: 12UIEmQ0uoG
testing/marionette/error.js
--- a/testing/marionette/error.js
+++ b/testing/marionette/error.js
@@ -169,17 +169,17 @@ class WebDriverError extends Error {
    *     to propagate.
    */
   constructor(x) {
     super(x);
     this.name = this.constructor.name;
     this.status = "webdriver error";
 
     // Error's ctor does not preserve x' stack
-    if (error.isError(x)) {
+    if (!error.isWebDriverError(x)) {
       this.stack = x.stack;
     }
   }
 
   /**
    * @return {Object.<string, string>}
    *     JSON serialisation of error prototype.
    */