Hacker News new | ask | show | jobs
by ingenter 3534 days ago
From what I see, the only thing that can help with post-mortem debugging is changing the promise so that it doesn't catch the exception when calling the initialiser or handler. You can still do whatever you could with Promises (but you have to do `Promise.reject(...)` or `reject(...)` instead of `throw ...`), but it's not going to conform with the standard. Many libraries are probably going to break if you drop-in a Promise implemented this way.

Edit: I didn't explain why this change is important: if the Promise is catching the exception, the Execution Context where exception was thrown is lost and (potentially) irrecoverable, the program has to crash there and now if you want to debug the reason for the exception. This is a property of the Promise standard, changes to debugging tools or environment won't help. You could make Node aware of promises, and capture the execution context with promise exception, but I don't think Promises are special enough.