From dcb4257898d1d8d37110a4364922206dad33f9fe Mon Sep 17 00:00:00 2001 From: lucaesposto <84773245+lucaesposto@users.noreply.github.com> Date: Tue, 1 Apr 2025 22:38:14 +0200 Subject: [PATCH] docs: fix bug in transaction example (#3414) Throwing error will not allow "finally" execution, so client.release() must be invoked before it. --- docs/pages/features/transactions.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pages/features/transactions.mdx b/docs/pages/features/transactions.mdx index 9280d1f4..4fc4a3cf 100644 --- a/docs/pages/features/transactions.mdx +++ b/docs/pages/features/transactions.mdx @@ -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 } ```