Home / Function/ logError() — react Function Reference

logError() — react Function Reference

Architecture documentation for the logError() function in Program.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  d3795732_d882_4f46_a959_cba0c8d5bcb9["logError()"]
  9aa4477d_960b_1ea1_b6d9_36076aaa70bd["Program.ts"]
  d3795732_d882_4f46_a959_cba0c8d5bcb9 -->|defined in| 9aa4477d_960b_1ea1_b6d9_36076aaa70bd
  4f591349_3d90_e4e5_51a6_a3b7ad077584["handleError()"]
  4f591349_3d90_e4e5_51a6_a3b7ad077584 -->|calls| d3795732_d882_4f46_a959_cba0c8d5bcb9
  db0bec13_2016_3880_d2b9_adcd797cdf2c["processFn()"]
  db0bec13_2016_3880_d2b9_adcd797cdf2c -->|calls| d3795732_d882_4f46_a959_cba0c8d5bcb9
  57b4d928_ecd2_92c9_b55b_ce5e00d0fba4["logEvent()"]
  d3795732_d882_4f46_a959_cba0c8d5bcb9 -->|calls| 57b4d928_ecd2_92c9_b55b_ce5e00d0fba4
  00c689b1_d881_800b_f1df_076ada6a2c75["toString()"]
  d3795732_d882_4f46_a959_cba0c8d5bcb9 -->|calls| 00c689b1_d881_800b_f1df_076ada6a2c75
  style d3795732_d882_4f46_a959_cba0c8d5bcb9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts lines 173–205

function logError(
  err: unknown,
  context: {
    opts: PluginOptions;
    filename: string | null;
  },
  fnLoc: t.SourceLocation | null,
): void {
  if (context.opts.logger) {
    if (err instanceof CompilerError) {
      for (const detail of err.details) {
        context.opts.logger.logEvent(context.filename, {
          kind: 'CompileError',
          fnLoc,
          detail,
        });
      }
    } else {
      let stringifiedError;
      if (err instanceof Error) {
        stringifiedError = err.stack ?? err.message;
      } else {
        stringifiedError = err?.toString() ?? '[ null ]';
      }

      context.opts.logger.logEvent(context.filename, {
        kind: 'PipelineError',
        fnLoc,
        data: stringifiedError,
      });
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does logError() do?
logError() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts.
Where is logError() defined?
logError() is defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts at line 173.
What does logError() call?
logError() calls 2 function(s): logEvent, toString.
What calls logError()?
logError() is called by 2 function(s): handleError, processFn.

Analyze Your Own Codebase

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

Try Supermodel Free