mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 14:51:12 -05:00
Refactor: Implement full error logging
This commit is contained in:
@@ -5,7 +5,7 @@ import { Label } from '@/components/ui/label';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { handleError, handleSuccess, handleInfo, AppError, getErrorMessage } from '@/lib/errorHandler';
|
||||
import { handleError, handleSuccess, handleInfo, handleNonCriticalError, AppError, getErrorMessage } from '@/lib/errorHandler';
|
||||
import { logger } from '@/lib/logger';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { useRequireMFA } from '@/hooks/useRequireMFA';
|
||||
@@ -51,10 +51,10 @@ export function TOTPSetup() {
|
||||
}));
|
||||
setFactors(totpFactors);
|
||||
} catch (error: unknown) {
|
||||
logger.error('Failed to fetch TOTP factors', {
|
||||
handleNonCriticalError(error, {
|
||||
action: 'Fetch TOTP factors',
|
||||
userId: user?.id,
|
||||
action: 'fetch_totp_factors',
|
||||
error: getErrorMessage(error)
|
||||
metadata: { context: 'initial_load' }
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -76,11 +76,6 @@ export function TOTPSetup() {
|
||||
setFactorId(data.id);
|
||||
setEnrolling(true);
|
||||
} catch (error: unknown) {
|
||||
logger.error('Failed to start TOTP enrollment', {
|
||||
userId: user?.id,
|
||||
action: 'totp_enroll_start',
|
||||
error: getErrorMessage(error)
|
||||
});
|
||||
handleError(
|
||||
new AppError(
|
||||
getErrorMessage(error) || 'Failed to start TOTP enrollment',
|
||||
@@ -148,13 +143,6 @@ export function TOTPSetup() {
|
||||
}, 2000);
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
logger.error('TOTP verification failed', {
|
||||
userId: user?.id,
|
||||
action: 'totp_verify',
|
||||
error: getErrorMessage(error),
|
||||
factorId
|
||||
});
|
||||
|
||||
handleError(
|
||||
new AppError(
|
||||
getErrorMessage(error) || 'Invalid verification code. Please try again.',
|
||||
|
||||
Reference in New Issue
Block a user