2) A request can fail and can timeout.
3) Writing to a file can fail.
And you get the idea. Don't omit error handling. Error handling is business logic too.
Being relaxed around error handling is the recipe for cascading server failure.
2) A request can fail and can timeout.
3) Writing to a file can fail.
And you get the idea. Don't omit error handling. Error handling is business logic too.
Being relaxed around error handling is the recipe for cascading server failure.
You should see the destructive effects of bad examples there.
You will eventually prove yourself wrong, since deemphasizing error handling goes wrong very quickly.
You don't have enough information to be outraged at the toy example.
But in this case encapsulation is a leaky abstraction that just makes the diagnosing of an error more cumbersome.
Then they added unhandled rejection warnings by default, and all was ok again - but I see why someone might insist that all examples have error handling.
.catch(error => {
process.nextTick(() => { throw error; });
})That means error handling may not be necessary inside that function. Errors are caught automatically and returned to the caller as rejected promise! You need error handling at the top level but not necessarily inside each function.