Webdriverio unconditionally when using 'call' method after reject #1763

Open
eGavr opened this Issue Dec 10, 2016 · 1 comment

Projects

None yet

3 participants

@eGavr
eGavr commented Dec 10, 2016 edited

The problem

const webdriverio = require('webdriverio');

const browser = webdriverio.remote({});

return browser
    .then(() => {
        throw new Error('I am an error!');
    })
    .call(() => console.log('Log from call'))
    .catch((e) => console.log(e));

In this case nodejs unconditionally exits because of an error, and this error can not be handled.

output:

Error: I am an error!
        at Object.<anonymous> (/absolute/path/wdio.js:7:15)
        at Object.exec (/absolute/path/node_modules/webdriverio/build/lib/helpers/safeExecute.js:28:24)
        at Object.resolve (/absolute/path/node_modules/webdriverio/build/lib/webdriverio.js:189:29)
        at /absolute/path/node_modules/webdriverio/build/lib/webdriverio.js:487:32
        at _fulfilled (/absolute/path/node_modules/q/q.js:834:54)
        at self.promiseDispatch.done (/absolute/path/node_modules/q/q.js:863:30)
        at Promise.promise.promiseDispatch (/absolute/path/node_modules/q/q.js:796:13)
        at /absolute/path/node_modules/q/q.js:556:49
        at runSingle (/absolute/path/node_modules/q/q.js:137:13)
        at flush (/absolute/path/node_modules/q/q.js:125:13)

This code works fine:

const webdriverio = require('webdriverio');

const browser = webdriverio.remote({});

return browser
    .then(() => {
        throw new Error('I am an error!');
    })
    .catch((e) => console.log(e));

output:

[Error: I am an error!]

Environment

  • WebdriverIO version: latest
  • Node.js version: 4.x
@j0tunn
Contributor
j0tunn commented Dec 10, 2016

@christian-bromann Can you explain please the difference between call and then methods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment