mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
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:
parent
a3fefe3183
commit
dcb4257898
@ -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
|
||||
}
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user