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

fix: handle undefined rejections #1961

Merged
merged 1 commit into from
Dec 10, 2021
Merged

fix: handle undefined rejections #1961

merged 1 commit into from
Dec 10, 2021

Conversation

alexandre-abrioux
Copy link
Contributor

@alexandre-abrioux alexandre-abrioux commented Oct 28, 2021

Winston cannot handle promise rejections if the rejected object is undefined.
A simple test is to add Promise.reject(undefined) somewhere in your app and Winston will throw the following exception:

TypeError: Cannot destructure property 'message' of 'err' as it is undefined.
    at RejectionHandler.getAllInfo (/.../node_modules/winston/lib/winston/rejection-handler.js:77:11)
    at RejectionHandler._unhandledRejection (/.../node_modules/winston/lib/winston/rejection-handler.js:168:23)

I added a test that checks for this error, and a fix that makes this test go green.

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

Successfully merging this pull request may close these issues.

2 participants