Home / Function/ collectStackTrace() — react Function Reference

collectStackTrace() — react Function Reference

Architecture documentation for the collectStackTrace() function in ReactFlightStackConfigV8.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  61de8561_a281_51c1_9a70_41fe59211c78["collectStackTrace()"]
  6b04fae3_e76f_58bb_e731_caa9abb4c49c["ReactFlightStackConfigV8.js"]
  61de8561_a281_51c1_9a70_41fe59211c78 -->|defined in| 6b04fae3_e76f_58bb_e731_caa9abb4c49c
  3890a326_1e32_462e_feaa_0e71b5156b1f["collectStackTracePrivate()"]
  61de8561_a281_51c1_9a70_41fe59211c78 -->|calls| 3890a326_1e32_462e_feaa_0e71b5156b1f
  style 61de8561_a281_51c1_9a70_41fe59211c78 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-server/src/ReactFlightStackConfigV8.js lines 120–140

function collectStackTrace(
  error: Error,
  structuredStackTrace: CallSite[],
): string {
  collectStackTracePrivate(error, structuredStackTrace);
  // At the same time we generate a string stack trace just in case someone
  // else reads it. Ideally, we'd call the previous prepareStackTrace to
  // ensure it's in the expected format but it's common for that to be
  // source mapped and since we do a lot of eager parsing of errors, it
  // would be slow in those environments. We could maybe just rely on those
  // environments having to disable source mapping globally to speed things up.
  // For now, we just generate a default V8 formatted stack trace without
  // source mapping as a fallback.
  const name = error.name || 'Error';
  const message = error.message || '';
  let stack = name + ': ' + message;
  for (let i = 0; i < structuredStackTrace.length; i++) {
    stack += '\n    at ' + structuredStackTrace[i].toString();
  }
  return stack;
}

Domain

Subdomains

Frequently Asked Questions

What does collectStackTrace() do?
collectStackTrace() is a function in the react codebase, defined in packages/react-server/src/ReactFlightStackConfigV8.js.
Where is collectStackTrace() defined?
collectStackTrace() is defined in packages/react-server/src/ReactFlightStackConfigV8.js at line 120.
What does collectStackTrace() call?
collectStackTrace() calls 1 function(s): collectStackTracePrivate.

Analyze Your Own Codebase

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

Try Supermodel Free