4 ms·
”One thing that burned me bad though was that without a `try` anywhere, my 100 line async function failed silently. I think because its transpiling to promises
by tlrobinson 8y ago
”One thing that burned me bad though was that without a `try` anywhere, my 100 line async function failed silently. I think because its transpiling to promises and nothing was handling a failed returned promise. Really really frustrating.”
This is a promise thing, it doesn’t really have to do with async/await or transpiling.
Node.js and some browsers have a warning or event you can listen for https://developer.mozilla.org/en-US/docs/Web/Events/unhandledrejection https://developer.mozilla.org/en-US/docs/Web/Events/unhandle...
- alangpierce 8y agoIt's not just certain environments, I'm fairly sure that if you use a normal promise polyfill like babel-polyfill provides, then unhandled promise rejection failures will always trigger window.onunhandledrejection, which is analogous to window.onerror (unhandled promise rejections in async code are the equivalent of unhandled exceptions in sync code). If you set up both of those to do any error handling/reporting that you need, you can avoid any issues of promise rejections getting swallowed.