Skip to content

Commit bc831f3

Browse files
authored
Merge pull request #189 from cortizg/es.javascript.info.1-11-03-pc
Promises chaining
2 parents 5ab1bec + f5a5221 commit bc831f3

File tree

5 files changed

+96
-94
lines changed

5 files changed

+96
-94
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
The short answer is: **no, they are not equal**:
21

3-
The difference is that if an error happens in `f1`, then it is handled by `.catch` here:
2+
La respuesta corta es: **no, no son iguales**:
3+
4+
La diferencia es que si ocurre un error en `f1`, entonces aqui es manejado por `.catch`:
45

56
```js run
67
promise
78
.then(f1)
89
.catch(f2);
910
```
1011

11-
...But not here:
12+
...Pero no aquí:
1213

1314
```js run
1415
promise
1516
.then(f1, f2);
1617
```
1718

18-
That's because an error is passed down the chain, and in the second code piece there's no chain below `f1`.
19+
Esto se debe a que se pasa un error por la cadena y en la segunda pieza del código no hay una cadena debajo de `f1`.
20+
21+
En otras palabras, `.then` pasa los resultados/errores al siguiente `.then/catch`. Entonces, en el primer ejemplo, hay un `catch` debajo, y en el segundo no lo hay, por lo que el error no se maneja.
1922

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.

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+
# Promesa: 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+
¿Son iguales estos fragmentos de código? En otras palabras, ¿se comportan de la misma manera en cualquier circunstancia, para cualquier función de controlador?
44

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

0 commit comments

Comments
 (0)