Home / File/ ReactFiberErrorLogger.js — react Source File

ReactFiberErrorLogger.js — react Source File

Architecture documentation for ReactFiberErrorLogger.js, a javascript file in the react codebase. 7 imports, 2 dependents.

File javascript BabelCompiler 7 imports 2 dependents

Entity Profile

Dependency Diagram

graph LR
  21a48769_5be6_7eac_e581_a4faa269674e["ReactFiberErrorLogger.js"]
  6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f["ReactInternalTypes.js"]
  21a48769_5be6_7eac_e581_a4faa269674e --> 6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f
  3c1744da_8f82_b464_9a56_73fd7302132b["ReactCapturedValue.js"]
  21a48769_5be6_7eac_e581_a4faa269674e --> 3c1744da_8f82_b464_9a56_73fd7302132b
  d3557f30_4fca_e30a_91c5_c23d4b8dba99["ReactWorkTags.js"]
  21a48769_5be6_7eac_e581_a4faa269674e --> d3557f30_4fca_e30a_91c5_c23d4b8dba99
  a6668d1d_397d_7807_719d_fdecf552fa4a["ReactFiberConfig.js"]
  21a48769_5be6_7eac_e581_a4faa269674e --> a6668d1d_397d_7807_719d_fdecf552fa4a
  6f207e69_195c_8592_d157_684fe7967d1f["getComponentNameFromFiber"]
  21a48769_5be6_7eac_e581_a4faa269674e --> 6f207e69_195c_8592_d157_684fe7967d1f
  20cbf540_4aea_6101_42b9_66d4c75ec091["reportGlobalError"]
  21a48769_5be6_7eac_e581_a4faa269674e --> 20cbf540_4aea_6101_42b9_66d4c75ec091
  1c5695a6_6806_ba54_2074_efc779e66da4["ReactSharedInternals"]
  21a48769_5be6_7eac_e581_a4faa269674e --> 1c5695a6_6806_ba54_2074_efc779e66da4
  2945bdb1_d075_d792_a028_13eee518c9d4["ReactFiberThrow.js"]
  2945bdb1_d075_d792_a028_13eee518c9d4 --> 21a48769_5be6_7eac_e581_a4faa269674e
  d73e9290_2d2e_5d3f_97dd_84929f205c77["ReactFiberWorkLoop.js"]
  d73e9290_2d2e_5d3f_97dd_84929f205c77 --> 21a48769_5be6_7eac_e581_a4faa269674e
  style 21a48769_5be6_7eac_e581_a4faa269674e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import type {Fiber, FiberRoot} from './ReactInternalTypes';
import type {CapturedValue} from './ReactCapturedValue';

import getComponentNameFromFiber from 'react-reconciler/src/getComponentNameFromFiber';

import {ClassComponent} from './ReactWorkTags';

import reportGlobalError from 'shared/reportGlobalError';

import ReactSharedInternals from 'shared/ReactSharedInternals';

import {bindToConsole} from './ReactFiberConfig';

// Side-channel since I'm not sure we want to make this part of the public API
let componentName: null | string = null;
let errorBoundaryName: null | string = null;

export function defaultOnUncaughtError(
  error: mixed,
  errorInfo: {+componentStack?: ?string},
): void {
  // Overriding this can silence these warnings e.g. for tests.
  // See https://github.com/facebook/react/pull/13384

  // For uncaught root errors we report them as uncaught to the browser's
  // onerror callback. This won't have component stacks and the error addendum.
  // So we add those into a separate console.warn.
  reportGlobalError(error);
  if (__DEV__) {
    const componentNameMessage = componentName
      ? `An error occurred in the <${componentName}> component.`
      : 'An error occurred in one of your React components.';

    const errorBoundaryMessage =
      'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
      'Visit https://react.dev/link/error-boundaries to learn more about error boundaries.';

    try {
      console.warn(
        '%s\n\n%s\n',
        componentNameMessage,
        errorBoundaryMessage,
        // We let our console.error wrapper add the component stack to the end.
      );
    } finally {
      // ignore
    }
  }
}

export function defaultOnCaughtError(
// ... (134 more lines)

Domain

Dependencies

Frequently Asked Questions

What does ReactFiberErrorLogger.js do?
ReactFiberErrorLogger.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does ReactFiberErrorLogger.js depend on?
ReactFiberErrorLogger.js imports 7 module(s): ReactCapturedValue.js, ReactFiberConfig.js, ReactInternalTypes.js, ReactSharedInternals, ReactWorkTags.js, getComponentNameFromFiber, reportGlobalError.
What files import ReactFiberErrorLogger.js?
ReactFiberErrorLogger.js is imported by 2 file(s): ReactFiberThrow.js, ReactFiberWorkLoop.js.
Where is ReactFiberErrorLogger.js in the architecture?
ReactFiberErrorLogger.js is located at packages/react-reconciler/src/ReactFiberErrorLogger.js (domain: BabelCompiler, directory: packages/react-reconciler/src).

Analyze Your Own Codebase

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

Try Supermodel Free