From 29fb04d03dcf5045b4d08f58f60265ba229a49e4 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Tue, 21 Oct 2025 16:01:45 +0000 Subject: [PATCH] Fix feature path catch blocks --- src/components/admin/MarkdownEditor.tsx | 2 +- src/components/admin/NovuMigrationUtility.tsx | 2 +- src/components/admin/ProfileAuditLog.tsx | 2 +- src/components/admin/SystemActivityLog.tsx | 2 +- src/components/admin/TestDataGenerator.tsx | 11 ++++++----- src/components/homepage/ContentTabs.tsx | 2 +- src/components/homepage/FeaturedParks.tsx | 2 +- src/components/parks/ParkGrid.tsx | 2 +- src/components/profile/AddRideCreditDialog.tsx | 2 +- src/components/profile/RideCreditCard.tsx | 6 +++--- src/components/profile/UserBlockButton.tsx | 2 +- src/components/profile/UserReviewsList.tsx | 2 +- src/components/reviews/ReviewForm.tsx | 2 +- src/components/reviews/ReviewsList.tsx | 2 +- src/hooks/moderation/useEntityCache.ts | 5 +++-- src/hooks/moderation/useModerationFilters.ts | 8 ++++---- src/hooks/moderation/useModerationQueueManager.ts | 6 +++--- src/hooks/moderation/usePagination.ts | 4 ++-- src/hooks/moderation/useProfileCache.ts | 4 ++-- src/hooks/useAutocompleteData.ts | 14 +++++++------- 20 files changed, 42 insertions(+), 40 deletions(-) diff --git a/src/components/admin/MarkdownEditor.tsx b/src/components/admin/MarkdownEditor.tsx index 07f2223d..682f6681 100644 --- a/src/components/admin/MarkdownEditor.tsx +++ b/src/components/admin/MarkdownEditor.tsx @@ -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'); } diff --git a/src/components/admin/NovuMigrationUtility.tsx b/src/components/admin/NovuMigrationUtility.tsx index 733a4392..e3456fab 100644 --- a/src/components/admin/NovuMigrationUtility.tsx +++ b/src/components/admin/NovuMigrationUtility.tsx @@ -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", diff --git a/src/components/admin/ProfileAuditLog.tsx b/src/components/admin/ProfileAuditLog.tsx index e9a2dd17..6e0fc49d 100644 --- a/src/components/admin/ProfileAuditLog.tsx +++ b/src/components/admin/ProfileAuditLog.tsx @@ -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); diff --git a/src/components/admin/SystemActivityLog.tsx b/src/components/admin/SystemActivityLog.tsx index 38ce618c..000c0b74 100644 --- a/src/components/admin/SystemActivityLog.tsx +++ b/src/components/admin/SystemActivityLog.tsx @@ -191,7 +191,7 @@ export const SystemActivityLog = forwardRef prev.filter((i) => i.id !== item.id)); - } catch (error) { + } catch (error: unknown) { const errorMsg = getErrorMessage(error); console.error("Error resetting submission:", errorMsg); toast({ @@ -439,7 +439,7 @@ export function useModerationQueueManager(config: ModerationQueueManagerConfig): // Refresh stats to update counts queue.refreshStats(); - } catch (error) { + } catch (error: unknown) { const errorMsg = getErrorMessage(error); console.error("Error retrying failed items:", errorMsg); toast({ diff --git a/src/hooks/moderation/usePagination.ts b/src/hooks/moderation/usePagination.ts index 0fd045de..a29d7e3f 100644 --- a/src/hooks/moderation/usePagination.ts +++ b/src/hooks/moderation/usePagination.ts @@ -121,7 +121,7 @@ export function usePagination(config: PaginationConfig = {}): PaginationState { if (saved) { return JSON.parse(saved); } - } catch (error) { + } catch (error: unknown) { console.error('Failed to load pagination state:', error); } @@ -157,7 +157,7 @@ export function usePagination(config: PaginationConfig = {}): PaginationState { pageSize, }) ); - } catch (error) { + } catch (error: unknown) { console.error('Failed to persist pagination state:', error); } } diff --git a/src/hooks/moderation/useProfileCache.ts b/src/hooks/moderation/useProfileCache.ts index cd6c29f6..66da9d07 100644 --- a/src/hooks/moderation/useProfileCache.ts +++ b/src/hooks/moderation/useProfileCache.ts @@ -118,8 +118,8 @@ export function useProfileCache() { } return data || []; - } catch (error) { - logger.error('Failed to bulk fetch profiles:', error); + } catch (error: unknown) { + logger.error('Failed to bulk fetch profiles:', { error: getErrorMessage(error) }); return []; } }, [getCached, setCached, getUncachedIds]); diff --git a/src/hooks/useAutocompleteData.ts b/src/hooks/useAutocompleteData.ts index 3c58d48a..17e17ab9 100644 --- a/src/hooks/useAutocompleteData.ts +++ b/src/hooks/useAutocompleteData.ts @@ -27,7 +27,7 @@ export function useCountries() { value: country.toLowerCase().replace(/\s+/g, '_') })) ); - } catch (error) { + } catch (error: unknown) { console.error('Error fetching countries:', error); setCountries([]); } finally { @@ -72,7 +72,7 @@ export function useStatesProvinces(country?: string) { value: state.toLowerCase().replace(/\s+/g, '_') })) ); - } catch (error) { + } catch (error: unknown) { console.error('Error fetching states/provinces:', error); setStatesProvinces([]); } finally { @@ -108,7 +108,7 @@ export function useManufacturers() { value: company.id })) ); - } catch (error) { + } catch (error: unknown) { console.error('Error fetching manufacturers:', error); setManufacturers([]); } finally { @@ -149,7 +149,7 @@ export function useRideModels(manufacturerId?: string) { value: model.id })) ); - } catch (error) { + } catch (error: unknown) { console.error('Error fetching ride models:', error); setRideModels([]); } finally { @@ -188,7 +188,7 @@ export function useCompanyHeadquarters() { value: hq.toLowerCase().replace(/\s+/g, '_') })) ); - } catch (error) { + } catch (error: unknown) { console.error('Error fetching headquarters:', error); setHeadquarters([]); } finally { @@ -224,7 +224,7 @@ export function useOperators() { value: company.id })) ); - } catch (error) { + } catch (error: unknown) { console.error('Error fetching operators:', error); setOperators([]); } finally { @@ -260,7 +260,7 @@ export function usePropertyOwners() { value: company.id })) ); - } catch (error) { + } catch (error: unknown) { console.error('Error fetching property owners:', error); setPropertyOwners([]); } finally {