What was your precise experience?
What was your precise experience?
In practice, this behavior causes very real problems and in node land they made the sane decision to kill the process whenever an unhandled promise rejection comes about. I don’t know if this has landed yet, but you’ll see a warning about it if you run a node process in which you reject a promise.
Throwing on unhandledRejection has been the default in Node.js >= 7 and browsers now have DOM Levels 1 and 3 events for unhandledrejection.
Regardless, the original poster was correct – this has been a sin of promises for a long time. What’s worse I think is that because of this we move have semantics that are close but not quite the same as exceptions. Case in point: throwing an exception while executing a promise function will reject the promise. But it’s not an exception anymore, even though the value of the rejection is in fact the exception. The semantics are now different – because promises.
Promises in JavaScript have a certain almost-but-not-quite quality to them.
[1] http://www.ecma-international.org/ecma-262/6.0/#sec-try-stat...
Sure there is. What else does the `throw` statement do, if not throw an exception?
[1] http://www.ecma-international.org/ecma-262/6.0/#sec-try-stat...