mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-27 22:07:04 -05:00
feat: Implement comprehensive error logging
This commit is contained in:
@@ -7,6 +7,7 @@ import { supabase } from '@/integrations/supabase/client';
|
||||
import { requestContext, type RequestContext } from './requestContext';
|
||||
import { breadcrumbManager } from './errorBreadcrumbs';
|
||||
import { captureEnvironmentContext } from './environmentContext';
|
||||
import { handleNonCriticalError } from './errorHandler';
|
||||
import { logger } from './logger';
|
||||
|
||||
export interface RequestTrackingOptions {
|
||||
@@ -55,7 +56,16 @@ export async function trackRequest<T>(
|
||||
parentRequestId: options.parentRequestId,
|
||||
traceId: context.traceId,
|
||||
}).catch(err => {
|
||||
logger.error('Failed to log request metadata', { error: err, context: 'RequestTracking' });
|
||||
handleNonCriticalError(err, {
|
||||
action: 'Log request metadata (success)',
|
||||
userId: options.userId,
|
||||
metadata: {
|
||||
endpoint: options.endpoint,
|
||||
method: options.method,
|
||||
statusCode: 200,
|
||||
requestId: context.requestId
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Cleanup context
|
||||
@@ -96,7 +106,17 @@ export async function trackRequest<T>(
|
||||
timezone: envContext.timezone,
|
||||
referrer: typeof document !== 'undefined' ? document.referrer : undefined,
|
||||
}).catch(err => {
|
||||
logger.error('Failed to log error metadata', { error: err, context: 'RequestTracking' });
|
||||
handleNonCriticalError(err, {
|
||||
action: 'Log request metadata (error)',
|
||||
userId: options.userId,
|
||||
metadata: {
|
||||
endpoint: options.endpoint,
|
||||
method: options.method,
|
||||
statusCode: 500,
|
||||
requestId: context.requestId,
|
||||
errorType: errorInfo.type
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Cleanup context
|
||||
|
||||
Reference in New Issue
Block a user