mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-30 01:47:05 -05:00
Fix remaining console statements
This commit is contained in:
@@ -18,19 +18,8 @@ interface ErrorBoundaryState {
|
||||
errorInfo: ErrorInfo | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic Error Boundary Component (P0 #5)
|
||||
*
|
||||
* Prevents component errors from crashing the entire application.
|
||||
* Shows user-friendly error UI with recovery options.
|
||||
*
|
||||
* Usage:
|
||||
* ```tsx
|
||||
* <ErrorBoundary context="PhotoUpload">
|
||||
* <PhotoUploadForm />
|
||||
* </ErrorBoundary>
|
||||
* ```
|
||||
*/
|
||||
type ErrorWithId = Error & { errorId: string };
|
||||
|
||||
export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
||||
constructor(props: ErrorBoundaryProps) {
|
||||
super(props);
|
||||
@@ -61,7 +50,7 @@ export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundarySt
|
||||
errorId,
|
||||
});
|
||||
|
||||
this.setState({ errorInfo, error: { ...error, errorId } as any });
|
||||
this.setState({ errorInfo, error: { ...error, errorId } as ErrorWithId });
|
||||
this.props.onError?.(error, errorInfo);
|
||||
}
|
||||
|
||||
@@ -105,9 +94,9 @@ export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundarySt
|
||||
<p className="text-sm mt-2">
|
||||
{this.state.error?.message || 'An unexpected error occurred'}
|
||||
</p>
|
||||
{(this.state.error as any)?.errorId && (
|
||||
{(this.state.error as ErrorWithId)?.errorId && (
|
||||
<p className="text-xs mt-2 font-mono bg-destructive/10 px-2 py-1 rounded">
|
||||
Reference ID: {((this.state.error as any).errorId as string).slice(0, 8)}
|
||||
Reference ID: {(this.state.error as ErrorWithId).errorId.slice(0, 8)}
|
||||
</p>
|
||||
)}
|
||||
</AlertDescription>
|
||||
|
||||
Reference in New Issue
Block a user