It's most likely Bluebird bug, as handled error should not be reported (assuming you properly handle promises in loadUrls
body). So probably you should report it to Bluebird issue tracker.
Concerning done
, it's pure access function that's best if used instead of then
or catch
when you just process resolved value.
It's good to treat done
as first choice function and use then
and catch
only if you really need transformation to other promise, with such approach you also don't need to rely on buggy errors monitoring (best to turn it off completely).
In your case done
should be used as:
lib.loadUrls().done(); // eventual error will be thrown
and if for some reason you want to handle error specifically (e.g. in running server you don't want it throw) do:
lib.loadUrls().done(null, function (error) {
// handle error
});
EDIT:
Just noticed, that you still want to process promise returned by lib.loadUrls().catch(..)
with finally
. In such case done
is not a solution. done
should only be used as final call, but you can combine it with finally
as follows:
lib.loadUrls().finally(function () {
// cleanup
}).done();