Home / Class/ ErrorBoundary Class — react Architecture

ErrorBoundary Class — react Architecture

Architecture documentation for the ErrorBoundary class in ErrorBoundary.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  cade3b26_aea5_d523_8a86_300a94565887["ErrorBoundary"]
  5ae46b4f_0f17_18a6_3def_6dc95832bf63["ErrorBoundary.js"]
  cade3b26_aea5_d523_8a86_300a94565887 -->|defined in| 5ae46b4f_0f17_18a6_3def_6dc95832bf63

Relationship Graph

Source Code

packages/react-devtools-shared/src/devtools/views/ErrorBoundary/ErrorBoundary.js lines 56–96

export default class ErrorBoundary extends Component<Props, State> {
  state: State = InitialState;

  static getDerivedStateFromError(error: any): {
    callStack: string | null,
    errorMessage: string | null,
    hasError: boolean,
    isTimeout: boolean,
    isUnknownHookError: boolean,
    isUnsupportedBridgeOperationError: boolean,
    isUserError: boolean,
  } {
    const errorMessage =
      typeof error === 'object' &&
      error !== null &&
      typeof error.message === 'string'
        ? error.message
        : null;

    const isTimeout = error instanceof TimeoutError;
    const isUserError = error instanceof UserError;
    const isUnknownHookError = error instanceof UnknownHookError;
    const isUnsupportedBridgeOperationError =
      error instanceof UnsupportedBridgeOperationError;

    const callStack =
      typeof error === 'object' &&
      error !== null &&
      typeof error.stack === 'string'
        ? error.stack.split('\n').slice(1).join('\n')
        : null;

    return {
      callStack,
      errorMessage,
      hasError: true,
      isUnsupportedBridgeOperationError,
      isUnknownHookError,
      isTimeout,
      isUserError,
    };

Domain

Frequently Asked Questions

What is the ErrorBoundary class?
ErrorBoundary is a class in the react codebase, defined in packages/react-devtools-shared/src/devtools/views/ErrorBoundary/ErrorBoundary.js.
Where is ErrorBoundary defined?
ErrorBoundary is defined in packages/react-devtools-shared/src/devtools/views/ErrorBoundary/ErrorBoundary.js at line 56.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free