feat: Implement comprehensive error logging

This commit is contained in:
gpt-engineer-app[bot]
2025-11-04 19:04:06 +00:00
parent 40529b17e2
commit 6e64b80106
8 changed files with 151 additions and 35 deletions

View File

@@ -1,6 +1,7 @@
import { useEffect } from 'react';
import { useAuth } from '@/hooks/useAuth';
import { useUnitPreferences } from '@/hooks/useUnitPreferences';
import { handleNonCriticalError } from '@/lib/errorHandler';
import { logger } from '@/lib/logger';
import * as storage from '@/lib/localStorage';
@@ -26,7 +27,14 @@ export function useLocationAutoDetect() {
autoDetectPreferences().then(() => {
storage.setItem('location_detection_attempted', 'true');
}).catch((error) => {
logger.error('Failed to auto-detect location', { error });
handleNonCriticalError(error, {
action: 'Auto-detect user location',
userId: user?.id,
metadata: {
autoDetectEnabled: preferences.auto_detect,
context: 'initial_load'
}
});
storage.setItem('location_detection_attempted', 'true');
});
}