Ability to set unhandled_rejection callback
sheerun opened this issue · comments
Adam Stankiewicz commented
Hey!
Your library is awesome, but the promises in my code get often rejected and I don't even know about it.. Could you provide Promise.unhandled_rejection function to handle unhandled rejections (I'd use it in development only)
Dylan Thacker-Smith commented
How would you define an unhandled rejection? Since a promise could be rejected before any callbacks are added to it, then it seems like we can only be sure that a promise is unhandled once it is being garbage collected (i.e. using ObjectSpace.define_finalizer).
Did you have any ideas of how this could be implemented? Could this be implemented in a class that derives from Promise to prototype the idea?