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
{{ message }}
This repository was archived by the owner on Mar 31, 2018. It is now read-only.
One of the suggested solutions to get proper post mortem core dumps is to only run promise handlers from the microtask queue in a try/catch block if a catch handler has already been added to the promise synchronously, when --abort-on-unhandled-rejection is passed as an argument.
Problems:
Breaks the promise constructor as well as existing promise code. With this implemented, existing libraries are just as likely to generate core dumps as the problem code we're trying to trace down. To prevent this, node would have to add logging of warnings for unhandled rejections when catch handlers are added asynchronously - a huge shift in the current promise ecosystem.
Wont work with generator-based solutions and generator-based async/await transpilers. The generator runners have to attach a catch handler to the promise to forward that to the generator, and they have no way of querying generators whether the current frame is within a try-catch block
Promises are designed to be used with try/catch. As such there will be little point in giving promises to users while forbidding them to use try/catch, especially with async/await or generators. Only if filtered catch is added to the language, then this change will start making sense.
proposed avoidance method: passing an object as a second argument is not ergonomic and against core promise point (error propagation)
alternate method: promise[methodNameToBeDetermined](predicate, handlerReturningPromise) would work better, but still misses the point of using async/await.
This issue is opened to discuss alternatives that may satisfy post mortem debugging needs.