-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
unexpected behavior with --unhandled-rejections=strict flag #41184
Comments
`lib/internal/process/promises.js` contains the following comment about --unhandled-rejections=strict. This commit updates the docs to reflect this: // --unhandled-rejections=strict: // Emit 'uncaughtException'. If it's not handled, print // the error to stderr and exit the process. // Otherwise, emit 'unhandledRejection'. If // 'unhandledRejection' is not // handled, emit 'UnhandledPromiseRejectionWarning'. Fixes: nodejs#41184
This comment indicates that the warning is expected when using
I wasn't able to reproduce this with the |
@cjihrig yes default behavior is different between node v14.18.2 and v16.13.1 but documents was not up to date. and that was confusing... |
`lib/internal/process/promises.js` contains the following comment about --unhandled-rejections=strict. This commit updates the docs to reflect this: // --unhandled-rejections=strict: // Emit 'uncaughtException'. If it's not handled, print // the error to stderr and exit the process. // Otherwise, emit 'unhandledRejection'. If // 'unhandledRejection' is not // handled, emit 'UnhandledPromiseRejectionWarning'. Fixes: #41184 PR-URL: #41194 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
`lib/internal/process/promises.js` contains the following comment about --unhandled-rejections=strict. This commit updates the docs to reflect this: // --unhandled-rejections=strict: // Emit 'uncaughtException'. If it's not handled, print // the error to stderr and exit the process. // Otherwise, emit 'unhandledRejection'. If // 'unhandledRejection' is not // handled, emit 'UnhandledPromiseRejectionWarning'. Fixes: #41184 PR-URL: #41194 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
`lib/internal/process/promises.js` contains the following comment about --unhandled-rejections=strict. This commit updates the docs to reflect this: // --unhandled-rejections=strict: // Emit 'uncaughtException'. If it's not handled, print // the error to stderr and exit the process. // Otherwise, emit 'unhandledRejection'. If // 'unhandledRejection' is not // handled, emit 'UnhandledPromiseRejectionWarning'. Fixes: #41184 PR-URL: #41194 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
`lib/internal/process/promises.js` contains the following comment about --unhandled-rejections=strict. This commit updates the docs to reflect this: // --unhandled-rejections=strict: // Emit 'uncaughtException'. If it's not handled, print // the error to stderr and exit the process. // Otherwise, emit 'unhandledRejection'. If // 'unhandledRejection' is not // handled, emit 'UnhandledPromiseRejectionWarning'. Fixes: nodejs#41184 PR-URL: nodejs#41194 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
`lib/internal/process/promises.js` contains the following comment about --unhandled-rejections=strict. This commit updates the docs to reflect this: // --unhandled-rejections=strict: // Emit 'uncaughtException'. If it's not handled, print // the error to stderr and exit the process. // Otherwise, emit 'unhandledRejection'. If // 'unhandledRejection' is not // handled, emit 'UnhandledPromiseRejectionWarning'. Fixes: #41184 PR-URL: #41194 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
export NODE_OPTIONS=--unhandled-rejections=none or In npmrc file in the project to resolve this error. It will stop prompting the error. |
Version
v16.13.1
Platform
Linux 5.11.0-41-generic #45~20.04.1-Ubuntu SMP Wed Nov 10 10:20:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
when we use flag
--unhandled-rejections=strict
we expect not to see anyUnhandledPromiseRejectionWarning
and Raise the unhandled rejection as an uncaught exception. but:and when we do not use
--unhandled-rejections=strict
flag:How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
It should do exactly the opposite
What do you see instead?
No response
Additional information
It has different behavior in node v14
The text was updated successfully, but these errors were encountered: