From df775e9aa367dcb3bb93434d06d7e670d59e1d01 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Thu, 2 Apr 2026 14:07:02 +0200 Subject: [PATCH] Improve error handling in `run` by preserving additional error details --- common/src/supabase/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/src/supabase/utils.ts b/common/src/supabase/utils.ts index 26ea221f..fa7b54f9 100644 --- a/common/src/supabase/utils.ts +++ b/common/src/supabase/utils.ts @@ -66,7 +66,9 @@ export async function run( export async function run(q: PromiseLike | PostgrestResponse>) { const {data, count, error} = await q if (error != null) { - throw error + const err = new Error(error.message) + Object.assign(err, error) // copies code, details, hint onto the Error + throw err } else { return {data, count} }