Browse Source

fix: add missing catch block in woocommerce-sync #74

Claude 5 months ago
parent
commit
4c55244b0a
1 changed files with 10 additions and 0 deletions
  1. 10 0
      supabase/functions/woocommerce-sync/index.ts

+ 10 - 0
supabase/functions/woocommerce-sync/index.ts

@@ -992,4 +992,14 @@ serve(wrapHandler('woocommerce-sync', async (req) => {
       { status: 405, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
       { status: 405, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
     )
     )
 
 
+  } catch (error: any) {
+    console.error('[WooCommerce] Error:', error)
+    return new Response(
+      JSON.stringify({
+        success: false,
+        error: error.message || 'An error occurred'
+      }),
+      { status: 500, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
+    )
+  }
 }))
 }))