mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 20:11:12 -05:00
Fix feature path catch blocks
This commit is contained in:
@@ -2,6 +2,7 @@ import { useRef, useCallback } from 'react';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import { createTableQuery } from '@/lib/supabaseHelpers';
|
||||
import { logger } from '@/lib/logger';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import { MODERATION_CONSTANTS } from '@/lib/moderation/constants';
|
||||
import type { Database } from '@/integrations/supabase/types';
|
||||
|
||||
@@ -183,8 +184,8 @@ export function useEntityCache() {
|
||||
}
|
||||
|
||||
return data || [];
|
||||
} catch (error) {
|
||||
logger.error(`Failed to bulk fetch ${type}:`, error);
|
||||
} catch (error: unknown) {
|
||||
logger.error(`Failed to bulk fetch ${type}:`, { error: getErrorMessage(error) });
|
||||
return [];
|
||||
}
|
||||
}, [getCached, setCached, getUncachedIds]);
|
||||
|
||||
@@ -132,7 +132,7 @@ export function useModerationFilters(
|
||||
if (saved) {
|
||||
return JSON.parse(saved);
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Failed to load persisted filters:', error);
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ export function useModerationFilters(
|
||||
return parsed;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Failed to load persisted sort:', error);
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ export function useModerationFilters(
|
||||
activeTab,
|
||||
})
|
||||
);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Failed to persist filters:', error);
|
||||
}
|
||||
}
|
||||
@@ -204,7 +204,7 @@ export function useModerationFilters(
|
||||
if (persist) {
|
||||
try {
|
||||
localStorage.setItem(`${storageKey}_sort`, JSON.stringify(sortConfig));
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
console.error('Failed to persist sort:', error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +330,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 deleting submission:", errorMsg);
|
||||
|
||||
@@ -371,7 +371,7 @@ export function useModerationQueueManager(config: ModerationQueueManagerConfig):
|
||||
queue.refreshStats();
|
||||
|
||||
setItems((prev) => 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({
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user