> You can't reasonably argue that this: try {
foo = JSON.parse(input)
} catch (er) {
return "invalid data"
}
is more lightweight than:
foo = JSON.parse(input)
if (!foo) return "invalid data
This is like saying that walking is faster then driving because I can walk 5 meters faster then it takes me to get into a car. Yes, error codes are more compact in a tiny "Hello world" example because it is only showing one function call. Exception handling becomes more compact when you're writing something less trivial and you don't have to repeat the same error handling code after every call.
> Try/catch is goto wrapped in pretty braces. There's no way to continue where you left off, once the error is handled.
Don't throw exceptions if you can handle the error and continue where you left off. Exceptions is for when you can't continue. Think of throwing as a way to roll back transaction, stop whatever you were trying to do, and go back to the last consistent state.
Obviously, exceptions are not perfect. As author correctly notes, they require careful consideration of what's exception and what's part of normal flow. But they were invented for a reason, and I don't see the article offering any alternative solutions to the problems that exceptions are solving now.