Explorar el Código

fix: add missing catch block in shoprenter-products endpoint #79

Claude hace 5 meses
padre
commit
b4535b1328
Se han modificado 1 ficheros con 10 adiciones y 1 borrados
  1. 10 1
      supabase/functions/shoprenter-products/index.ts

+ 10 - 1
supabase/functions/shoprenter-products/index.ts

@@ -161,5 +161,14 @@ serve(wrapHandler('shoprenter-products', async (req) => {
       }),
       { status: 200, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
     )
-
+  } catch (error) {
+    console.error('[ShopRenter Products] Error:', error)
+    return new Response(
+      JSON.stringify({
+        error: error instanceof Error ? error.message : 'Unknown error occurred',
+        success: false
+      }),
+      { status: 500, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
+    )
+  }
 }))