mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 12:31:26 -05:00
Fix critical path catch blocks
This commit is contained in:
@@ -109,7 +109,7 @@ export const ModerationQueue = forwardRef<ModerationQueueRef, ModerationQueuePro
|
||||
variant: 'destructive',
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching items for edit:', error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
|
||||
@@ -82,7 +82,7 @@ export function PhotoSubmissionDisplay({ submissionId }: PhotoSubmissionDisplayP
|
||||
|
||||
setPhotos(data || []);
|
||||
console.log(`✅ Successfully loaded ${data?.length || 0} photos`);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('❌ PhotoSubmissionDisplay error:', errorMsg);
|
||||
setPhotos([]);
|
||||
|
||||
@@ -68,7 +68,7 @@ export function ReportButton({ entityType, entityId, className }: ReportButtonPr
|
||||
setOpen(false);
|
||||
setReportType('');
|
||||
setReason('');
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error submitting report:', error);
|
||||
toast({
|
||||
title: "Error",
|
||||
|
||||
@@ -121,7 +121,7 @@ export function UserRoleManager() {
|
||||
const existingUserIds = userRoles.map(ur => ur.user_id);
|
||||
const filteredResults = (data || []).filter(profile => !existingUserIds.includes(profile.user_id));
|
||||
setSearchResults(filteredResults);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error searching users:', error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -143,7 +143,7 @@ export function AccountProfileTab() {
|
||||
|
||||
await refreshProfile();
|
||||
handleSuccess('Profile updated', 'Your profile has been successfully updated.');
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
handleError(error, { action: 'Update profile', userId: user.id });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -204,7 +204,7 @@ export function AccountProfileTab() {
|
||||
|
||||
setShowCancelEmailDialog(false);
|
||||
await refreshProfile();
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
handleError(error, { action: 'Cancel email change' });
|
||||
} finally {
|
||||
setCancellingEmail(false);
|
||||
|
||||
@@ -41,7 +41,7 @@ export function DeletionStatusBanner({ scheduledDate, onCancelled }: DeletionSta
|
||||
});
|
||||
|
||||
onCancelled();
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
toast({
|
||||
variant: 'destructive',
|
||||
|
||||
@@ -49,7 +49,7 @@ export function SimplePhotoUpload({ onUpload, disabled, children }: SimplePhotoU
|
||||
title: 'Image uploaded',
|
||||
description: 'Your image has been uploaded successfully'
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
toast({
|
||||
title: 'Upload failed',
|
||||
description: getErrorMessage(error),
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -70,7 +70,7 @@ export function PhotoUpload({
|
||||
objectUrlsRef.current.forEach(url => {
|
||||
try {
|
||||
URL.revokeObjectURL(url);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error revoking object URL:', error);
|
||||
}
|
||||
});
|
||||
@@ -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',
|
||||
|
||||
@@ -49,7 +49,7 @@ export const useAvatarUpload = (
|
||||
handleSuccess('Avatar updated', 'Your avatar has been successfully updated.');
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
// Rollback on error
|
||||
setState({
|
||||
url: initialUrl,
|
||||
|
||||
Reference in New Issue
Block a user