Skip to content

Commit 4b0e075

Browse files
committed
Translation of Promises chaining
1 parent ba3d996 commit 4b0e075

File tree

5 files changed

+93
-93
lines changed

5 files changed

+93
-93
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
The short answer is: **no, they are not equal**:
1+
A resposta breve é: **não, eles não são iguais**:
22

3-
The difference is that if an error happens in `f1`, then it is handled by `.catch` here:
3+
A diferença é que se um erro ocorrer em `f1` ele será tratado pelo `.catch` neste caso:
44

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

11-
...But not here:
11+
...Mas não neste:
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+
Isso é devido ao erro ser propagado pela cadeia, e no segundo código não há cadeia após `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+
Em outras palavras, `.then` passa resultados/erros para o próximo `.then/catch`. Então, no primeiro exemplo, há um `catch` em seguida, e no segundo exemplo não há, então o erro não é tratado.

1-js/11-async/03-promise-chaining/01-then-vs-catch/task.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Promise: then versus catch
1+
# Promessa: then versus 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+
Estes fragmentos de código são iguais? Em outras palavras, eles se comportam da mesma maneira, em quaisquer circunstâncias, para qualquer função tratadora?
44

55
```js
66
promise.then(f1).catch(f2);

0 commit comments

Comments
 (0)