Skip to content

Commit bc845fd

Browse files
authored
make wording clearer
1 parent 30f1dc4 commit bc845fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ new Promise((resolve, reject) => {
7676

7777
The "invisible `try..catch`" around the executor automatically catches the error and treats it as a rejection.
7878

79-
That's so not only in the executor, but in handlers as well. If we `throw` inside a `.then` handler, that means a rejected promise, so the control jumps to the nearest error handler.
79+
This happens not only in the executor, but in its handlers as well. If we `throw` inside a `.then` handler, that means a rejected promise, so the control jumps to the nearest error handler.
8080

8181
Here's an example:
8282

@@ -90,7 +90,7 @@ new Promise((resolve, reject) => {
9090
}).catch(alert); // Error: Whoops!
9191
```
9292

93-
That's so not only for `throw`, but for any errors, including programming errors as well:
93+
This happens for all errors, not just those caused by the `throw` statement. For example, a programming error:
9494

9595
```js run
9696
new Promise((resolve, reject) => {
@@ -102,7 +102,7 @@ new Promise((resolve, reject) => {
102102
}).catch(alert); // ReferenceError: blabla is not defined
103103
```
104104

105-
As a side effect, the final `.catch` not only catches explicit rejections, but also occasional errors in the handlers above.
105+
The final `.catch` not only catches explicit rejections, but also occasional errors in the handlers above.
106106

107107
## Rethrowing
108108

@@ -120,7 +120,7 @@ new Promise((resolve, reject) => {
120120

121121
throw new Error("Whoops!");
122122

123-
}).catch(function(error) {
123+
}).catch(function(error) {
124124

125125
alert("The error is handled, continue normally");
126126

0 commit comments

Comments
 (0)