Skip to content

Commit 086812d

Browse files
authored
Simplified code example (#177)
The code in a `finally` block runs even if there was an error while executing the `catch` block, so the "async/await - check out a client" example can be simplified.
1 parent c3c89d6 commit 086812d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/features/3-pooling.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ pool
7373
try {
7474
const res = await client.query('SELECT * FROM users WHERE id = $1', [1])
7575
console.log(res.rows[0])
76+
} catch (err) {
77+
console.log(err.stack)
7678
} finally {
77-
// Make sure to release the client before any error handling,
78-
// just in case the error handling itself throws an error.
7979
client.release()
8080
}
81-
})().catch(err => console.log(err.stack))
81+
})()
8282
```
8383

8484
<div class='message is-danger'>

0 commit comments

Comments
 (0)