2 ms·
"...without a `try` anywhere, my 100 line async function failed silently." I've played with catchify a bit. https://github.com/majgis/catchify https://github.
by specialist 8y ago
"...without a `try` anywhere, my 100 line async function failed silently."
I've played with catchify a bit.
https://github.com/majgis/catchify https://github.com/majgis/catchify
https://www.npmjs.com/package/catchify https://www.npmjs.com/package/catchify
Feels less awful. But I'm still ambivalent. Callbacks vs promises vs async/await vs catchify's golang style error propagation. Yay.
I intended to weave in timeouts and tracing (metrics). See if that makes nodejs dev work sufferable. Maybe a catchify & timeoutify & traceify hybrid will keep me from playing in traffic.
- tlrobinson 8y agoasync/await works best when all of your async code uses it, so it’s kind of silly to pass a callback into an async function like this example from the article that inspired catchify: async function asyncTask(cb) { async functions return a promise that rejects if an error is thrown (either directly or by a promise that is awaited on), so there’s no need to handle every error if you’re ok with it just propagating.