mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 14:31:12 -05:00
feat: Implement High Priority Console Cleanup
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user