You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Deprecation DEP0018, which is associated with the poorly named UnhandledPromiseRejectionWarning, is misleading and fundamentally incorrect. Asynchronously handling promises cannot be deprecated, as it is a basic tenant of the promise spec.
When a promise that is handled asynchronously is rejected before the handler is attached, the following is currently logged:
(node:45) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:45) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Describe the solution you'd like
While preserving the warning may be useful, the deprecation (which will never happen) should be removed.
When a promise that is handled asynchronously is rejected before the handler is attached, only the following should be logged:
(node:45) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
Describe alternatives you've considered
Finalizing this proposed deprecation is tracked by #20392. This proposal is deeply flawed and would have far-reaching consequences if implemented. In #31148 I proposed a strategy to address the same pain points in a correct, more generic way. Regardless of whether my approach is taken or not, async handling of promises is a core feature that simply cannot be deprecated, and we should remove the erroneous deprecation accordingly.
The text was updated successfully, but these errors were encountered:
At this point, the overwhelming and stable consensus within Node.js core has been to maintain the deprecation. However, it is possible to use the --unhandled-rejections=none command-line argument (and within the NODE_OPTIONS environment variable to achieve the behavior you're looking for..
Closing as there is no further action to take on this specific issue. The strategy around unhandled rejections is being refined in other PRs and issues
Is your feature request related to a problem? Please describe.
Deprecation DEP0018, which is associated with the poorly named
UnhandledPromiseRejectionWarning
, is misleading and fundamentally incorrect. Asynchronously handling promises cannot be deprecated, as it is a basic tenant of the promise spec.When a promise that is handled asynchronously is rejected before the handler is attached, the following is currently logged:
Describe the solution you'd like
While preserving the warning may be useful, the deprecation (which will never happen) should be removed.
When a promise that is handled asynchronously is rejected before the handler is attached, only the following should be logged:
Describe alternatives you've considered
Finalizing this proposed deprecation is tracked by #20392. This proposal is deeply flawed and would have far-reaching consequences if implemented. In #31148 I proposed a strategy to address the same pain points in a correct, more generic way. Regardless of whether my approach is taken or not, async handling of promises is a core feature that simply cannot be deprecated, and we should remove the erroneous deprecation accordingly.
The text was updated successfully, but these errors were encountered: