Fix error boundary logging

This commit is contained in:
gpt-engineer-app[bot]
2025-11-04 18:58:03 +00:00
parent ded4dfd59c
commit 40529b17e2
5 changed files with 51 additions and 53 deletions

View File

@@ -2,7 +2,7 @@ import React, { Component, ErrorInfo, ReactNode } from 'react';
import { AlertTriangle, Home, RefreshCw } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { logger } from '@/lib/logger';
import { handleError } from '@/lib/errorHandler';
interface RouteErrorBoundaryProps {
children: ReactNode;
@@ -32,17 +32,14 @@ export class RouteErrorBoundary extends Component<RouteErrorBoundaryProps, Route
}
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
// Generate error ID for user reference
const errorId = crypto.randomUUID();
// Critical: Route-level error - highest priority logging
logger.error('Route-level error caught by boundary', {
error: error.message,
stack: error.stack,
componentStack: errorInfo.componentStack,
url: window.location.href,
severity: 'critical',
errorId,
// Log to database and get error ID for user reference
const errorId = handleError(error, {
action: 'Route-level component crash',
metadata: {
componentStack: errorInfo.componentStack,
url: window.location.href,
severity: 'critical',
},
});
this.setState({ error: { ...error, errorId } as ErrorWithId });