0

I'm using the nightmareJs package (http://www.nightmarejs.org/) and it seems that the website produces an or timeout that isn't captured by the promise and hence the callback is never executed.

Here is the code:

nightmareJs
        .goto('https://www.website.org/account')
        .type('#username', user)
        .type('#password', pass)
        .click('#loginButton')
        .wait('#indexPage > div > main')
        .evaluate(function () {
            return document.querySelector('#registeredGuest') !== null;
        })
        .end()
        .then(function (result) {
            const ancestryAccountType = result ? 'trial' : 'paid';
            const modifierObject = {};
            modifierObject.ancestryAccountType = ancestryAccountType;
            updateIdentitiesAncestryObj(userId, modifierObject);
            return cb();
        })
        .catch(function (error) {
            console.error('Search failed:', error);
            return cb(error);
        });

Does anyone have an idea how I can catch the exception?

a4xrbj1
  • 445
  • 3
  • 21
  • Which exception? – Bergi Oct 08 '17 at 13:24
  • That's the problem, the log doesn't show any. The code is part of the Meteor jobCollection package from vsivsi and he recommends in a similar case (job not restarting after failure) this: "My guess is that under some rare circumstances log.error() and/or job.fail() are throwing, which unwinds the stack out of the worker function without invoking the callback, borking a worker slot in that processJobs() queue" -> github.com/vsivsi/meteor-job-collection/issues/158 – a4xrbj1 Oct 08 '17 at 14:30
  • Trying this solution now (applying another .then() after the .catch() -> https://stackoverflow.com/questions/35999072/what-is-the-equivalent-of-bluebird-promise-finally-in-native-es6-promises – a4xrbj1 Oct 08 '17 at 14:31

0 Answers0