Skip to content

Commit b1b1699

Browse files
committed
Translate tasks in 6-async/03-promise-chaining
1 parent 6e7baff commit b1b1699

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
The short answer is: **no, they are not the equal**:
1+
解答: **いいえ、それらは等しくありません**:
22

3-
The difference is that if an error happens in `f1`, then it is handled by `.catch` here:
3+
違いですが、以下では `f1` でエラーが発生したとき、`.catch` で処理されます:
44

55
```js run
66
promise
77
.then(f1)
88
.catch(f2);
99
```
1010

11-
...But not here:
11+
...しかしここでは違います:
1212

1313
```js run
1414
promise
1515
.then(f1, f2);
1616
```
1717

18-
That's because an error is passed down the chain, and in the second code piece there's no chain below `f1`.
18+
なぜならエラーはチェーンを下に進み、2番目のコードは `f1` の下のチェーンにはないためです。
1919

20-
In other words, `.then` passes results/errors to the next `.then/catch`. So in the first example, there's a `catch` below, and in the second one -- there isn't, so the error is unhandled.
20+
つまり、`.then` は次の `.then/catch` へ結果/エラーを渡します。そのため、最初の例では下に `catch` があり、2つ目の例は -- ありません。なので、エラーは処理されません。

6-async/03-promise-chaining/01-then-vs-catch/task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Promise: then versus catch
1+
# Promise: then vs catch
22

3-
Are these code fragments equal? In other words, do they behave the same way in any circumstances, for any handler functions?
3+
これらのコードは等しいでしょうか?言い換えると、それらはどんな状況でも任意のハンドラ関数に対して、同じように振る舞いますか?
44

55
```js
66
promise.then(f1, f2);
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The answer is: **no, it won't**:
1+
解答: **いいえ、実行されません**:
22

33
```js run
44
new Promise(function(resolve, reject) {
@@ -8,6 +8,6 @@ new Promise(function(resolve, reject) {
88
}).catch(alert);
99
```
1010

11-
As said in the chapter, there's an "implicit `try..catch`" around the function code. So all synchronous errors are handled.
11+
チャプターの中で言った通り、関数コードの周りには "暗黙の `try..catch`" があります。そのため、すべての同期エラーは処理されます。
1212

13-
But here the error is generated not while the executor is running, but later. So the promise can't handle it.
13+
しかし、ここではエラーは executor が実行中でなく、その後に生成されます。したがって、promise はそれを処理できません。

6-async/03-promise-chaining/02-error-async/task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Error in setTimeout
1+
# setTimeout でのエラー
22

3-
How do you think, does the `.catch` trigger? Explain your answer?
3+
`.catch` はトリガされると思いますか?またその理由を説明できますか?
44

55
```js
66
new Promise(function(resolve, reject) {

0 commit comments

Comments
 (0)