Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/documentation/0054-node-exceptions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ Using promises you can chain different operations, and handle errors at the end:

```js
doSomething1()
.then(doSomething2())
.then(doSomething3())
.then(doSomething2)
.then(doSomething3)
.catch(err => console.error(err))
```

Expand All @@ -98,14 +98,14 @@ const doSomething1 = () => {
To be able to handle errors locally without handling them in the function we call, we can break the chain you can create a function in each `then()` and process the exception:

```js
doSomething1
.then((() => {
doSomething1()
.then(() => {
return doSomething2().catch(err => {
//handle error
throw err //break the chain!
})
})
.then((() => {
.then(() => {
return doSomething2().catch(err => {
//handle error
throw err //break the chain!
Expand Down