docs: fix bug in transaction example (#3414)

Throwing error will not allow "finally" execution, so client.release() must be invoked before it.
This commit is contained in:
lucaesposto 2025-04-01 22:38:14 +02:00 committed by GitHub
parent a3fefe3183
commit dcb4257898
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,10 +31,10 @@ try {
const insertPhotoValues = [res.rows[0].id, 's3.bucket.foo']
await client.query(insertPhotoText, insertPhotoValues)
await client.query('COMMIT')
client.release()
} catch (e) {
await client.query('ROLLBACK')
throw e
} finally {
client.release()
throw e
}
```