4 ms·
Error handling in asynchronous JavaScript is quite notorious for being easy to screw up.
by mbrock 9y ago
Error handling in asynchronous JavaScript is quite notorious for being easy to screw up.
- nilliams 9y agoTrue for async code, but if you use something like ShellJS [1] (which would be an easy way to rewrite a bash script that was getting out of hand), all commands are synchronous, so error handling is just try/catch. [1] https://www.npmjs.com/package/shelljs https://www.npmjs.com/package/shelljs
- moosingin3space 9y agoIf only everyone used promises...I can dream, right? Regardless, I'd actually prefer Haskell's do-notation for both asynchronous commands and shell-scripting tasks. Even though Haskell isn't my favorite language, do-notation is quite nice for this.