Skip to content

Commit ee8a211

Browse files
authored
Merge pull request #102 from TevaHenry/chainage-promesse
Promises chaining
2 parents ae112a7 + 5d4fe8d commit ee8a211

File tree

3 files changed

+89
-89
lines changed

3 files changed

+89
-89
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 the equal**:
1+
La réponse courte est: **non, ils ne sont pas égaux**:
22

3-
The difference is that if an error happens in `f1`, then it is handled by `.catch` here:
3+
La différence est que si une erreur survient dans `f1`, elle est gérée par` .catch` ici:
44

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

11-
...But not here:
11+
...Mais pas ici:
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+
En effet, une erreur est transmise dans la chaîne et, dans le second code, il n'y a pas de chaîne à la suite de `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+
En d'autres termes, `.then` transmet les résultats/erreurs au prochain `.then/catch`. Donc, dans le premier exemple, il y a un `catch` en dessous, et dans le second - il n'y en a pas, donc l'erreur n'est pas gérée.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Promise: then versus catch
1+
# Promesse: then contre 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+
Ces fragments de code sont-ils égaux? En d'autres termes, se comportent-ils de la même manière en toutes circonstances, pour toutes les fonctions gestionnaires?
44

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

9-
Versus:
9+
Contre:
1010

1111
```js
1212
promise.then(f1, f2);

0 commit comments

Comments
 (0)