From be459f3da123c5aa1ef526aceb074830ec2ccb70 Mon Sep 17 00:00:00 2001 From: adriancuadrado <29214635+adriancuadrado@users.noreply.github.com> Date: Wed, 2 Apr 2025 00:40:16 +0200 Subject: [PATCH] Improved example in transactions.mdx This is the kind of thing the `finally` block was inveted for, to release resources and things like that. --- 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 4fc4a3cff..9280d1f40 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') - client.release() throw e +} finally { + client.release() } ```