You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/11-async/04-promise-error-handling/article.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ new Promise((resolve, reject) => {
76
76
77
77
The "invisible `try..catch`" around the executor automatically catches the error and treats it as a rejection.
78
78
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.
80
80
81
81
Here's an example:
82
82
@@ -90,7 +90,7 @@ new Promise((resolve, reject) => {
90
90
}).catch(alert); // Error: Whoops!
91
91
```
92
92
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:
94
94
95
95
```js run
96
96
newPromise((resolve, reject) => {
@@ -102,7 +102,7 @@ new Promise((resolve, reject) => {
102
102
}).catch(alert); // ReferenceError: blabla is not defined
103
103
```
104
104
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.
106
106
107
107
## Rethrowing
108
108
@@ -120,7 +120,7 @@ new Promise((resolve, reject) => {
0 commit comments