mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 10:51:13 -05:00
Refactor: Implement full error logging
This commit is contained in:
@@ -12,8 +12,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import { handleError, handleSuccess, getErrorMessage } from '@/lib/errorHandler';
|
||||
import { logger } from '@/lib/logger';
|
||||
import { handleError, handleSuccess, handleNonCriticalError, getErrorMessage } from '@/lib/errorHandler';
|
||||
|
||||
interface UserProfile {
|
||||
id: string;
|
||||
@@ -131,7 +130,13 @@ export function ProfileManager() {
|
||||
}
|
||||
});
|
||||
|
||||
if (logError) logger.error('Failed to log admin action', { error: getErrorMessage(logError) });
|
||||
if (logError) {
|
||||
handleNonCriticalError(logError, {
|
||||
action: 'Log admin action (ban/unban)',
|
||||
userId: user?.id,
|
||||
metadata: { targetUserId, ban, banReason }
|
||||
});
|
||||
}
|
||||
|
||||
handleSuccess(
|
||||
'Success',
|
||||
@@ -211,7 +216,13 @@ export function ProfileManager() {
|
||||
_details: { role: newRole, previous_roles: currentRoles }
|
||||
});
|
||||
|
||||
if (logError) logger.error('Failed to log admin action', { error: getErrorMessage(logError) });
|
||||
if (logError) {
|
||||
handleNonCriticalError(logError, {
|
||||
action: 'Log admin action (role change)',
|
||||
userId: user?.id,
|
||||
metadata: { targetUserId, newRole, previousRoles: currentRoles }
|
||||
});
|
||||
}
|
||||
|
||||
handleSuccess('Success', 'User role updated successfully.');
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import { useAdminSettings } from '@/hooks/useAdminSettings';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { useIsMobile } from '@/hooks/use-mobile';
|
||||
import { smartMergeArray } from '@/lib/smartStateUpdate';
|
||||
import { handleError, handleSuccess } from '@/lib/errorHandler';
|
||||
import { handleError, handleSuccess, handleNonCriticalError } from '@/lib/errorHandler';
|
||||
|
||||
// Type-safe reported content interfaces
|
||||
interface ReportedReview {
|
||||
@@ -383,7 +383,11 @@ export const ReportsQueue = forwardRef<ReportsQueueRef>((props, ref) => {
|
||||
}
|
||||
});
|
||||
} catch (auditError) {
|
||||
logger.error('Failed to log report action audit', { error: auditError });
|
||||
handleNonCriticalError(auditError, {
|
||||
action: 'Log report action audit',
|
||||
userId: user?.id,
|
||||
metadata: { reportId, action }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user