Update documentation and ErrorBoundary component
- Updated architecture documentation with refactoring notes - Updated task documentation with progress - Enhanced ErrorBoundary component for better error handling Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -107,9 +107,18 @@ export class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoun
|
||||
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {
|
||||
const { onError } = this.props;
|
||||
|
||||
// Extract componentStack from errorInfo
|
||||
// Note: componentStack is not part of the public React.ErrorInfo type definition,
|
||||
// but is available at runtime via React DevTools. We cast to any to access it.
|
||||
// This captures the React component hierarchy where the error occurred, which is
|
||||
// valuable for debugging but may change in future React versions.
|
||||
// TODO: Consider removing when React types include componentStack in ErrorInfo
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
||||
const componentStack = (errorInfo as any).componentStack as string | undefined;
|
||||
|
||||
// Log the error using telemetry for distributed tracing
|
||||
recordCritical("component_render_error", error, {
|
||||
component_stack: errorInfo.componentStack,
|
||||
component_stack: componentStack,
|
||||
error_message: error.message,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user