mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 08:11:13 -05:00
Connect to Lovable Cloud
Add centralized errorFormatter to convert various error types into readable messages, and apply it across edge functions. Replace String(error) usage with formatEdgeError, update relevant imports, fix a throw to use toError, and enhance logger to log formatted errors. Includes new errorFormatter.ts and widespread updates to 18+ edge functions plus logger integration.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
|
||||
import { edgeLogger, startRequest, endRequest } from "../_shared/logger.ts";
|
||||
import { formatEdgeError } from "../_shared/errorFormatter.ts";
|
||||
|
||||
const corsHeaders = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
@@ -45,7 +46,7 @@ function cleanupExpiredEntries() {
|
||||
// CRITICAL: Increment failure counter and log detailed error information
|
||||
cleanupFailureCount++;
|
||||
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
const errorMessage = formatEdgeError(error);
|
||||
|
||||
edgeLogger.error('Cleanup error', {
|
||||
attempt: cleanupFailureCount,
|
||||
@@ -284,7 +285,7 @@ serve(async (req) => {
|
||||
|
||||
} catch (error: unknown) {
|
||||
// Enhanced error logging for better visibility and debugging
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
const errorMessage = formatEdgeError(error);
|
||||
|
||||
edgeLogger.error('Location detection error', {
|
||||
error: errorMessage,
|
||||
|
||||
Reference in New Issue
Block a user