From 375630bbd2e421a5690b9c696f7ae01818d037d7 Mon Sep 17 00:00:00 2001 From: Jonathan Chue <5141427+jchue@users.noreply.github.com> Date: Sat, 7 Dec 2019 16:46:14 -0800 Subject: [PATCH] Make minor grammar corrections/updates to async/promise-error-handling --- 1-js/11-async/04-promise-error-handling/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/11-async/04-promise-error-handling/article.md b/1-js/11-async/04-promise-error-handling/article.md index b467d5e0..ad7be243 100644 --- a/1-js/11-async/04-promise-error-handling/article.md +++ b/1-js/11-async/04-promise-error-handling/article.md @@ -60,7 +60,7 @@ new Promise((resolve, reject) => { new Promise((resolve, reject) => { *!* reject(new Error("Whoops!")); -*/!* +*/!* }).catch(alert); // Error: Whoops! ``` @@ -98,7 +98,7 @@ The final `.catch` not only catches explicit rejections, but also occasional err As we already noticed, `.catch` at the end of the chain is similar to `try..catch`. We may have as many `.then` handlers as we want, and then use a single `.catch` at the end to handle errors in all of them. -In a regular `try..catch` we can analyze the error and maybe rethrow it if can't handle. The same thing is possible for promises. +In a regular `try..catch` we can analyze the error and maybe rethrow it if it can't be handled. The same thing is possible for promises. If we `throw` inside `.catch`, then the control goes to the next closest error handler. And if we handle the error and finish normally, then it continues to the closest successful `.then` handler.