mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2026-03-26 06:49:29 -04:00
Fix feature path catch blocks
This commit is contained in:
@@ -154,7 +154,7 @@ export function MarkdownEditor({
|
||||
if (!imageUrl) throw new Error('Failed to generate image URL');
|
||||
|
||||
return imageUrl;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Image upload failed:', error);
|
||||
throw new Error(error instanceof Error ? error.message : 'Failed to upload image');
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ export function NovuMigrationUtility() {
|
||||
title: "Migration completed",
|
||||
description: `Successfully migrated ${successCount} users. ${failureCount} failures.`,
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
toast({
|
||||
variant: "destructive",
|
||||
|
||||
@@ -29,7 +29,7 @@ export function ProfileAuditLog() {
|
||||
|
||||
if (error) throw error;
|
||||
setLogs((data || []) as AuditLogEntry[]);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
handleError(error, { action: 'Load audit logs' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -191,7 +191,7 @@ export const SystemActivityLog = forwardRef<SystemActivityLogRef, SystemActivity
|
||||
type: filterType === 'all' ? undefined : filterType,
|
||||
});
|
||||
setActivities(data);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error loading system activities:', error);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
|
||||
@@ -11,6 +11,7 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/component
|
||||
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@/components/ui/alert-dialog';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import { Beaker, CheckCircle, ChevronDown, Trash2, AlertTriangle } from 'lucide-react';
|
||||
import { clearTestData, getTestDataStats } from '@/lib/testDataGenerator';
|
||||
|
||||
@@ -87,7 +88,7 @@ export function TestDataGenerator() {
|
||||
try {
|
||||
const data = await getTestDataStats();
|
||||
setStats(data);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Failed to load stats:', error);
|
||||
}
|
||||
};
|
||||
@@ -149,11 +150,11 @@ export function TestDataGenerator() {
|
||||
});
|
||||
|
||||
await loadStats();
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Generation error:', error);
|
||||
toast({
|
||||
title: "Generation failed",
|
||||
description: error.message || "Failed to generate test data",
|
||||
description: getErrorMessage(error),
|
||||
variant: "destructive",
|
||||
});
|
||||
} finally {
|
||||
@@ -173,11 +174,11 @@ export function TestDataGenerator() {
|
||||
description: `Removed ${deleted} test submissions`
|
||||
});
|
||||
setResults(null);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Clear error:', error);
|
||||
toast({
|
||||
title: 'Clear Failed',
|
||||
description: error.message,
|
||||
description: getErrorMessage(error),
|
||||
variant: 'destructive'
|
||||
});
|
||||
} finally {
|
||||
|
||||
@@ -91,7 +91,7 @@ export function ContentTabs() {
|
||||
setRecentRides(recentRidesData || []);
|
||||
setRecentChanges(processedChanges);
|
||||
setRecentlyOpened(combinedOpened);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching content:', error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -41,7 +41,7 @@ export function FeaturedParks() {
|
||||
|
||||
setTopRatedParks(topRated || []);
|
||||
setMostRidesParks(mostRides || []);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching featured parks:', error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -40,7 +40,7 @@ export function ParkGrid() {
|
||||
|
||||
if (error) throw error;
|
||||
setParks(data || []);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching parks:', error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -68,7 +68,7 @@ export function AddRideCreditDialog({ userId, open, onOpenChange, onSuccess }: A
|
||||
handleReset();
|
||||
onSuccess(data.id); // Pass the new ID
|
||||
onOpenChange(false);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error adding credit:', error);
|
||||
toast.error(getErrorMessage(error));
|
||||
} finally {
|
||||
|
||||
@@ -68,7 +68,7 @@ export function RideCreditCard({ credit, position, maxPosition, viewMode, isEdit
|
||||
setIsEditing(false);
|
||||
// Optimistic update - pass specific changes
|
||||
onUpdate(credit.id, { ride_count: editCount });
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error updating count:', error);
|
||||
toast.error(getErrorMessage(error));
|
||||
} finally {
|
||||
@@ -91,7 +91,7 @@ export function RideCreditCard({ credit, position, maxPosition, viewMode, isEdit
|
||||
if (error) throw error;
|
||||
|
||||
toast.success('Ride count increased');
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error incrementing count:', error);
|
||||
toast.error(getErrorMessage(error));
|
||||
// Rollback on error
|
||||
@@ -111,7 +111,7 @@ export function RideCreditCard({ credit, position, maxPosition, viewMode, isEdit
|
||||
try {
|
||||
await onReorder(credit.id, editPosition);
|
||||
toast.success('Position updated');
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error changing position:', error);
|
||||
toast.error(getErrorMessage(error));
|
||||
setEditPosition(position);
|
||||
|
||||
@@ -43,7 +43,7 @@ export function UserBlockButton({ targetUserId, targetUsername, variant = 'outli
|
||||
});
|
||||
|
||||
setReason('');
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('Error blocking user:', errorMsg);
|
||||
toast({
|
||||
|
||||
@@ -93,7 +93,7 @@ export function UserReviewsList({ userId, reviewCount }: UserReviewsListProps) {
|
||||
|
||||
if (error) throw error;
|
||||
setReviews(data || []);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching reviews:', error);
|
||||
toast.error(getErrorMessage(error));
|
||||
} finally {
|
||||
|
||||
@@ -120,7 +120,7 @@ export function ReviewForm({
|
||||
setRating(0);
|
||||
setPhotos([]);
|
||||
onReviewSubmitted();
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error submitting review:', error);
|
||||
toast({
|
||||
title: "Error",
|
||||
|
||||
@@ -62,7 +62,7 @@ export function ReviewsList({ entityType, entityId, entityName }: ReviewsListPro
|
||||
|
||||
const { data } = await query;
|
||||
setReviews((data || []) as ReviewWithProfile[]);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching reviews:', error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
Reference in New Issue
Block a user