Improve error handling and authentication for uploads and notifications

Refactor PhotoUpload component to fetch session token before polling, enhance error handling in NotificationService and versioningHelpers with `instanceof Error` checks, and add comprehensive validation for request body fields in the create-novu-subscriber Supabase function.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 8d708ff6-09f1-4b67-8edc-de3fcb2349b3
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
This commit is contained in:
pac7
2025-10-07 14:55:35 +00:00
parent f4020969d8
commit 88ed3207c4
5 changed files with 138 additions and 6 deletions

View File

@@ -67,7 +67,7 @@ class NotificationService {
return { success: true };
} catch (error: any) {
console.error('Error creating Novu subscriber:', error);
return { success: false, error: error.message };
return { success: false, error: error instanceof Error ? error.message : 'An unexpected error occurred' };
}
}
@@ -91,7 +91,7 @@ class NotificationService {
return { success: true };
} catch (error: any) {
console.error('Error updating Novu subscriber:', error);
return { success: false, error: error.message };
return { success: false, error: error instanceof Error ? error.message : 'An unexpected error occurred' };
}
}

View File

@@ -77,7 +77,7 @@ export async function createEntityVersion(params: {
console.error('Error creating entity version:', error);
toast({
title: 'Version Creation Failed',
description: error.message,
description: error instanceof Error ? error.message : 'An unexpected error occurred',
variant: 'destructive',
});
return null;