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
--- 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.
*/