Skip to content

Commit 8b295f6

Browse files
committed
closes #3062
1 parent 964c7db commit 8b295f6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

1-js/11-async/04-promise-error-handling/article.md

+1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ In non-browser environments like Node.js there are other ways to track unhandled
199199
## Summary
200200

201201
- `.catch` handles errors in promises of all kinds: be it a `reject()` call, or an error thrown in a handler.
202+
- `.then` also catches errors in the same manner, if given thee second argument (which is the error handler).
202203
- We should place `.catch` exactly in places where we want to handle errors and know how to handle them. The handler should analyze errors (custom error classes help) and rethrow unknown ones (maybe they are programming mistakes).
203204
- It's ok not to use `.catch` at all, if there's no way to recover from an error.
204205
- In any case we should have the `unhandledrejection` event handler (for browsers, and analogs for other environments) to track unhandled errors and inform the user (and probably our server) about them, so that our app never "just dies".

0 commit comments

Comments
 (0)