feat: Implement High Priority Console Cleanup

This commit is contained in:
gpt-engineer-app[bot]
2025-10-21 18:53:17 +00:00
parent 6a70267a57
commit d89f9cc6fc
5 changed files with 90 additions and 19 deletions

View File

@@ -1,5 +1,7 @@
import React, { useState } from 'react';
import { invokeWithTracking } from '@/lib/edgeFunctionTracking';
import { logger } from '@/lib/logger';
import { getErrorMessage } from '@/lib/errorHandler';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
@@ -168,11 +170,19 @@ export function UppyPhotoSubmissionUpload({
));
} catch (error: unknown) {
console.error('Upload error:', error);
const errorMsg = getErrorMessage(error);
logger.error('Photo submission upload failed', {
photoTitle: photo.title,
photoOrder: photo.order,
fileName: photo.file?.name,
error: errorMsg
});
setPhotos(prev => prev.map(p =>
p === photo ? { ...p, uploadStatus: 'failed' as const } : p
));
throw new Error(`Failed to upload ${photo.title || 'photo'}: ${error instanceof Error ? error.message : 'Unknown error'}`);
throw new Error(`Failed to upload ${photo.title || 'photo'}: ${errorMsg}`);
}
}
}
@@ -248,11 +258,19 @@ export function UppyPhotoSubmissionUpload({
setPhotos([]);
onSubmissionComplete?.();
} catch (error: unknown) {
console.error('Submission error:', error);
const errorMsg = getErrorMessage(error);
logger.error('Photo submission failed', {
entityType,
entityId,
photoCount: photos.length,
userId: user?.id,
error: errorMsg
});
toast({
variant: 'destructive',
title: 'Submission Failed',
description: error instanceof Error ? error.message : 'There was an error submitting your photos. Please try again.',
description: errorMsg || 'There was an error submitting your photos. Please try again.',
});
} finally {
setIsSubmitting(false);