From 8bc6a6b7b5e7aa061dd046847aabd11300449588 Mon Sep 17 00:00:00 2001 From: Greg Richardson Date: Mon, 6 Feb 2023 23:20:51 -0700 Subject: [PATCH] chore(docs-gpt): better logs for application errors --- supabase/functions/clippy-search/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/supabase/functions/clippy-search/index.ts b/supabase/functions/clippy-search/index.ts index 5b4a33d464e..8a80354e429 100644 --- a/supabase/functions/clippy-search/index.ts +++ b/supabase/functions/clippy-search/index.ts @@ -168,11 +168,14 @@ serve(async (req) => { headers: { ...corsHeaders, 'Content-Type': 'application/json' }, } ) + } else if (err instanceof ApplicationError) { + // Print out application errors with their additional data + console.error(`${err.message}: ${JSON.stringify(err.data)}`) + } else { + // Print out unexpected errors as is to help with debugging + console.error(err) } - // Print out unexpected errors to help with debugging - console.error(err) - // TODO: include more response info in debug environments return new Response( JSON.stringify({