From 546237d84edd1dbe3364183ec4ad89a0065badb0 Mon Sep 17 00:00:00 2001 From: lucaesposto <84773245+lucaesposto@users.noreply.github.com> Date: Tue, 1 Apr 2025 18:50:00 +0200 Subject: [PATCH] docs: fix bug in transaction example 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 9280d1f40..4fc4a3cff 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 } ```