mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 05:11:14 -05:00
Fix critical path catch blocks
This commit is contained in:
@@ -67,7 +67,7 @@ export function EntityMultiImageUploader({
|
||||
if (image.isLocal && image.url.startsWith('blob:')) {
|
||||
try {
|
||||
URL.revokeObjectURL(image.url);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error revoking object URL:', error);
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ export function EntityMultiImageUploader({
|
||||
banner_assignment: bannerIndex >= 0 ? bannerIndex : null,
|
||||
card_assignment: cardIndex >= 0 ? cardIndex : null,
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Failed to load entity photos:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
|
||||
@@ -76,7 +76,7 @@ export function EntityPhotoGallery({
|
||||
|
||||
console.log('📷 [FETCH PHOTOS] Mapped photos:', mappedPhotos);
|
||||
setPhotos(mappedPhotos);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('📷 [FETCH PHOTOS] Error:', error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -77,7 +77,7 @@ export function PhotoManagementDialog({
|
||||
|
||||
if (error) throw error;
|
||||
setPhotos(data || []);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching photos:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
@@ -172,7 +172,7 @@ export function PhotoManagementDialog({
|
||||
setPhotoToDelete(null);
|
||||
setDeleteReason('');
|
||||
onOpenChange(false);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error requesting photo deletion:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
@@ -237,7 +237,7 @@ export function PhotoManagementDialog({
|
||||
description: 'Your photo edit has been submitted for moderation',
|
||||
});
|
||||
onOpenChange(false);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error requesting photo edit:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
|
||||
@@ -66,17 +66,17 @@ export function PhotoUpload({
|
||||
const canUploadMore = totalImages < actualMaxFiles;
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
objectUrlsRef.current.forEach(url => {
|
||||
try {
|
||||
URL.revokeObjectURL(url);
|
||||
} catch (error) {
|
||||
console.error('Error revoking object URL:', error);
|
||||
}
|
||||
});
|
||||
objectUrlsRef.current.clear();
|
||||
};
|
||||
}, []);
|
||||
return () => {
|
||||
objectUrlsRef.current.forEach(url => {
|
||||
try {
|
||||
URL.revokeObjectURL(url);
|
||||
} catch (error: unknown) {
|
||||
console.error('Error revoking object URL:', error);
|
||||
}
|
||||
});
|
||||
objectUrlsRef.current.clear();
|
||||
};
|
||||
}, []);
|
||||
|
||||
const createObjectUrl = (file: File): string => {
|
||||
const url = URL.createObjectURL(file);
|
||||
@@ -89,7 +89,7 @@ export function PhotoUpload({
|
||||
try {
|
||||
URL.revokeObjectURL(url);
|
||||
objectUrlsRef.current.delete(url);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error revoking object URL:', error);
|
||||
}
|
||||
}
|
||||
@@ -194,7 +194,7 @@ export function PhotoUpload({
|
||||
};
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Status poll error:', error);
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ export function PhotoUpload({
|
||||
|
||||
revokeObjectUrl(previewUrl);
|
||||
throw new Error('Upload timeout - image processing took too long');
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
revokeObjectUrl(previewUrl);
|
||||
throw error;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ export function PhotoUpload({
|
||||
}
|
||||
|
||||
setUploadProgress(100);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
previewUrls.forEach(url => revokeObjectUrl(url));
|
||||
const errorMsg = getErrorMessage(error);
|
||||
setError(errorMsg);
|
||||
|
||||
@@ -167,7 +167,7 @@ export function UppyPhotoSubmissionUpload({
|
||||
p === photo ? { ...p, url: cloudflareUrl, uploadStatus: 'uploaded' as const } : p
|
||||
));
|
||||
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Upload error:', error);
|
||||
setPhotos(prev => prev.map(p =>
|
||||
p === photo ? { ...p, uploadStatus: 'failed' as const } : p
|
||||
@@ -255,7 +255,7 @@ export function UppyPhotoSubmissionUpload({
|
||||
setTitle('');
|
||||
setPhotos([]);
|
||||
onSubmissionComplete?.();
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Submission error:', error);
|
||||
toast({
|
||||
variant: 'destructive',
|
||||
|
||||
@@ -200,7 +200,7 @@ export function UppyPhotoUpload({
|
||||
const url = await uploadSingleFile(file);
|
||||
newUrls.push(url);
|
||||
setUploadProgress(Math.round(((i + 1) / totalFiles) * 100));
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error(`Upload failed for ${file.name}:`, error);
|
||||
toast({
|
||||
variant: 'destructive',
|
||||
|
||||
Reference in New Issue
Block a user