feat: better timeout stack trace (#2843)

fixes #2653
This commit is contained in:
Yaniv Efraim
2018-07-05 02:39:09 +03:00
committed by Andrey Lushnikov
parent 22fa00a7b3
commit cfc0571c1a
2 changed files with 9 additions and 2 deletions

View File

@@ -836,8 +836,10 @@ class WaitTask {
});
// Since page navigation requires us to re-install the pageScript, we should track
// timeout on our end.
if (timeout)
this._timeoutTimer = setTimeout(() => this.terminate(new Error(`waiting for ${title} failed: timeout ${timeout}ms exceeded`)), timeout);
if (timeout) {
const timeoutError = new Error(`waiting for ${title} failed: timeout ${timeout}ms exceeded`);
this._timeoutTimer = setTimeout(() => this.terminate(timeoutError), timeout);
}
this.rerun();
}