by mdc2161 · 1y ago · 0 comments
For example:
- the event loop is still not being blocked
- the calling code can still be flat instead of nested callbacks (truly synchronous) or chained `.then` calls
Is it a little bit more boilerplate? Yes, definitely, and it's certainly less nice to look at. But it's linter-enforceable consistency that removes the cognitive overhead of an annoying to debug footgun.
Note: My favorite style is typed error returns instead of thrown exceptions. In that world, you only need try/catches at the boundaries of your code and for application crashing exceptions. Unfortunately most codebases aren't written like that and I'm often working in inherited code instead of greenfield.