Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure error object is defined before access its message #1568

Closed
reedfeng opened this issue Aug 1, 2018 · 2 comments · Fixed by #1569
Closed

Make sure error object is defined before access its message #1568

reedfeng opened this issue Aug 1, 2018 · 2 comments · Fixed by #1569
Labels

Comments

@reedfeng
Copy link
Contributor

reedfeng commented Aug 1, 2018

https://github.com/caolan/async/blob/master/lib/asyncify.js#L90

function handlePromise(promise, callback) {
    return promise.then(value => {
        invokeCallback(callback, null, value);
    }, err => {
        invokeCallback(callback, err.message ? err : new Error(err));
    });
}

err && err.message will be better when I happened to reject a promise without reason.

@aearly aearly added the bug label Aug 2, 2018
@aearly
Copy link
Collaborator

aearly commented Aug 2, 2018

A PR to fix this would be welcome!

@reedfeng
Copy link
Contributor Author

reedfeng commented Aug 2, 2018

@aearly, PR #1569 is created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants