mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 16:11:12 -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,6 +1,7 @@
|
||||
import { serve } from "https://deno.land/std@0.190.0/http/server.ts";
|
||||
import { Novu } from "npm:@novu/api@1.6.0";
|
||||
import { edgeLogger } from '../_shared/logger.ts';
|
||||
import { formatEdgeError } from '../_shared/errorFormatter.ts';
|
||||
|
||||
const corsHeaders = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
@@ -218,7 +219,7 @@ serve(async (req) => {
|
||||
} catch (topicError: unknown) {
|
||||
// Non-blocking - log error but don't fail the request
|
||||
edgeLogger.error('Failed to add subscriber to users topic', {
|
||||
error: topicError instanceof Error ? topicError.message : String(topicError),
|
||||
error: formatEdgeError(topicError),
|
||||
subscriberId,
|
||||
requestId: tracking.requestId
|
||||
});
|
||||
@@ -238,7 +239,7 @@ serve(async (req) => {
|
||||
} catch (error: unknown) {
|
||||
const duration = endRequest(tracking);
|
||||
edgeLogger.error('Error creating Novu subscriber', {
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error: formatEdgeError(error),
|
||||
requestId: tracking.requestId,
|
||||
duration
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user