Skip to content

Commit dcb4257

Browse files
authored
docs: fix bug in transaction example (#3414)
Throwing error will not allow "finally" execution, so client.release() must be invoked before it.
1 parent a3fefe3 commit dcb4257

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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()
3435
} catch (e) {
3536
await client.query('ROLLBACK')
36-
throw e
37-
} finally {
3837
client.release()
38+
throw e
3939
}
4040
```

0 commit comments

Comments
 (0)