mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 08:31:13 -05:00
Fix remaining catch blocks
This commit is contained in:
@@ -86,7 +86,7 @@ export function validateEmail(email: string): { valid: boolean; error?: string }
|
||||
try {
|
||||
emailSchema.parse(email);
|
||||
return { valid: true };
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof z.ZodError) {
|
||||
return { valid: false, error: error.issues[0]?.message };
|
||||
}
|
||||
@@ -101,7 +101,7 @@ export function validateUrl(url: string): { valid: boolean; error?: string } {
|
||||
try {
|
||||
urlSchema.parse(url);
|
||||
return { valid: true };
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof z.ZodError) {
|
||||
return { valid: false, error: error.issues[0]?.message };
|
||||
}
|
||||
@@ -116,7 +116,7 @@ export function validateUsername(username: string): { valid: boolean; error?: st
|
||||
try {
|
||||
usernameSchema.parse(username);
|
||||
return { valid: true };
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof z.ZodError) {
|
||||
return { valid: false, error: error.issues[0]?.message };
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ export async function signOutUser(): Promise<AuthServiceResponse> {
|
||||
clearAllAuthFlags();
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Unknown error',
|
||||
|
||||
@@ -64,7 +64,7 @@ class AuthStorage {
|
||||
// Clean URL
|
||||
window.history.replaceState({}, document.title, window.location.pathname);
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
authError('[AuthStorage] Failed to recover session from URL:', error);
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class AuthStorage {
|
||||
}
|
||||
authLog('[AuthStorage] Using memory storage');
|
||||
return this.memoryStorage.get(key) || null;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
authError('[AuthStorage] Error reading from storage:', error);
|
||||
return this.memoryStorage.get(key) || null;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ class AuthStorage {
|
||||
}
|
||||
// Always keep in memory as backup
|
||||
this.memoryStorage.set(key, value);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
authError('[AuthStorage] Error writing to storage:', error);
|
||||
// Fallback to memory only
|
||||
this.memoryStorage.set(key, value);
|
||||
@@ -142,7 +142,7 @@ class AuthStorage {
|
||||
this.storage.removeItem(key);
|
||||
}
|
||||
this.memoryStorage.delete(key);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
authError('[AuthStorage] Error removing from storage:', error);
|
||||
this.memoryStorage.delete(key);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ class AuthStorage {
|
||||
// Clear memory storage
|
||||
this.memoryStorage.clear();
|
||||
authLog('[AuthStorage] ✓ All auth storage cleared');
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
authError('[AuthStorage] Error clearing storage:', error);
|
||||
// Still clear memory storage as fallback
|
||||
this.memoryStorage.clear();
|
||||
|
||||
@@ -108,7 +108,7 @@ export async function handleExtendLock(
|
||||
action: 'lock_extended',
|
||||
submissionId,
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Failed to extend lock', {
|
||||
action: 'extend_lock_error',
|
||||
submissionId,
|
||||
|
||||
@@ -244,8 +244,8 @@ export async function fetchSubmissions(
|
||||
submissions: enrichedSubmissions,
|
||||
totalCount: count || 0,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error fetching submissions:', error);
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching submissions:', error instanceof Error ? error.message : String(error));
|
||||
return {
|
||||
submissions: [],
|
||||
totalCount: 0,
|
||||
@@ -281,8 +281,8 @@ export async function fetchUserProfiles(
|
||||
}
|
||||
|
||||
return new Map(profiles?.map(p => [p.user_id, p]) || []);
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch user profiles:', error);
|
||||
} catch (error: unknown) {
|
||||
console.error('Failed to fetch user profiles:', error instanceof Error ? error.message : String(error));
|
||||
return new Map();
|
||||
}
|
||||
}
|
||||
@@ -385,8 +385,8 @@ export async function getQueueStats(
|
||||
escalated,
|
||||
total,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error fetching queue stats:', error);
|
||||
} catch (error: unknown) {
|
||||
console.error('Error fetching queue stats:', error instanceof Error ? error.message : String(error));
|
||||
return {
|
||||
pending: 0,
|
||||
flagged: 0,
|
||||
|
||||
@@ -28,7 +28,7 @@ class NotificationService {
|
||||
.maybeSingle();
|
||||
|
||||
return !!data?.setting_value;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Failed to check Novu status', {
|
||||
action: 'check_novu_status',
|
||||
error: error instanceof Error ? error.message : String(error)
|
||||
@@ -80,7 +80,7 @@ class NotificationService {
|
||||
});
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error in updateSubscriber', {
|
||||
action: 'update_novu_subscriber',
|
||||
userId: subscriberData.subscriberId,
|
||||
@@ -162,7 +162,7 @@ class NotificationService {
|
||||
});
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error in createSubscriber', {
|
||||
action: 'create_novu_subscriber',
|
||||
userId: subscriberData.subscriberId,
|
||||
@@ -258,7 +258,7 @@ class NotificationService {
|
||||
});
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error updating notification preferences', {
|
||||
action: 'update_notification_preferences',
|
||||
userId,
|
||||
@@ -314,7 +314,7 @@ class NotificationService {
|
||||
workflowPreferences: data.workflow_preferences,
|
||||
frequencySettings: data.frequency_settings
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error fetching notification preferences', {
|
||||
action: 'fetch_notification_preferences',
|
||||
userId,
|
||||
@@ -345,7 +345,7 @@ class NotificationService {
|
||||
}
|
||||
|
||||
return data || [];
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error fetching notification templates', {
|
||||
action: 'fetch_notification_templates',
|
||||
error: error instanceof Error ? error.message : String(error)
|
||||
@@ -394,7 +394,7 @@ class NotificationService {
|
||||
});
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error triggering notification', {
|
||||
action: 'trigger_notification',
|
||||
workflowId: payload.workflowId,
|
||||
@@ -439,7 +439,7 @@ class NotificationService {
|
||||
submissionId: payload.submission_id,
|
||||
requestId
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error notifying moderators', {
|
||||
action: 'notify_moderators',
|
||||
submissionId: payload.submission_id,
|
||||
|
||||
@@ -60,7 +60,7 @@ export async function trackRequest<T>(
|
||||
|
||||
return { result, requestId: context.requestId, duration };
|
||||
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
const duration = Date.now() - start;
|
||||
const errorInfo = error instanceof Error
|
||||
? { type: error.name, message: error.message }
|
||||
|
||||
@@ -254,8 +254,8 @@ export async function clearTestData(): Promise<{ deleted: number }> {
|
||||
}
|
||||
|
||||
return { deleted: submissionCount };
|
||||
} catch (error) {
|
||||
console.error('Error clearing test data:', error);
|
||||
} catch (error: unknown) {
|
||||
console.error('Error clearing test data:', error instanceof Error ? error.message : String(error));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export async function trackPageView(
|
||||
entity_id: entityId,
|
||||
session_hash: getSessionHash()
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
// Fail silently - don't break the page if tracking fails
|
||||
logger.error('Failed to track page view', { entityType, entityId });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user