Skip to content

Commit be459f3

Browse files
Improved example in transactions.mdx
This is the kind of thing the `finally` block was inveted for, to release resources and things like that.
1 parent a5d03a0 commit be459f3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: docs/pages/features/transactions.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ try {
3131
const insertPhotoValues = [res.rows[0].id, 's3.bucket.foo']
3232
await client.query(insertPhotoText, insertPhotoValues)
3333
await client.query('COMMIT')
34-
client.release()
3534
} catch (e) {
3635
await client.query('ROLLBACK')
37-
client.release()
3836
throw e
37+
} finally {
38+
client.release()
3939
}
4040
```

0 commit comments

Comments
 (0)