parseStackTrace() — react Function Reference
Architecture documentation for the parseStackTrace() function in parseStackTrace.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 46b4ae1b_01e7_57f6_d691_ef43e922cf3b["parseStackTrace()"] c70671e1_42cb_8c92_da33_5303a72f89b1["parseStackTrace.js"] 46b4ae1b_01e7_57f6_d691_ef43e922cf3b -->|defined in| c70671e1_42cb_8c92_da33_5303a72f89b1 3bf3e90e_51d6_910a_d710_2cbd2bff3d49["extractLocationFromOwnerStack()"] 3bf3e90e_51d6_910a_d710_2cbd2bff3d49 -->|calls| 46b4ae1b_01e7_57f6_d691_ef43e922cf3b aa8dcbb7_2a63_5ee0_2383_fe507f8a453f["parseStackTraceFromString()"] 46b4ae1b_01e7_57f6_d691_ef43e922cf3b -->|calls| aa8dcbb7_2a63_5ee0_2383_fe507f8a453f style 46b4ae1b_01e7_57f6_d691_ef43e922cf3b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-devtools-shared/src/backend/utils/parseStackTrace.js lines 278–317
export function parseStackTrace(
error: Error,
skipFrames: number,
): ReactStackTrace {
// We can only get structured data out of error objects once. So we cache the information
// so we can get it again each time. It also helps performance when the same error is
// referenced more than once.
const existing = stackTraceCache.get(error);
if (existing !== undefined) {
return existing;
}
// We override Error.prepareStackTrace with our own version that collects
// the structured data. We need more information than the raw stack gives us
// and we need to ensure that we don't get the source mapped version.
collectedStackTrace = null;
framesToSkip = skipFrames;
const previousPrepare = Error.prepareStackTrace;
Error.prepareStackTrace = collectStackTrace;
let stack;
try {
stack = String(error.stack);
} finally {
Error.prepareStackTrace = previousPrepare;
}
if (collectedStackTrace !== null) {
const result = collectedStackTrace;
collectedStackTrace = null;
stackTraceCache.set(error, result);
return result;
}
// If the stack has already been read, or this is not actually a V8 compatible
// engine then we might not get a normalized stack and it might still have been
// source mapped. Regardless we try our best to parse it.
const parsedFrames = parseStackTraceFromString(stack, skipFrames);
stackTraceCache.set(error, parsedFrames);
return parsedFrames;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does parseStackTrace() do?
parseStackTrace() is a function in the react codebase, defined in packages/react-devtools-shared/src/backend/utils/parseStackTrace.js.
Where is parseStackTrace() defined?
parseStackTrace() is defined in packages/react-devtools-shared/src/backend/utils/parseStackTrace.js at line 278.
What does parseStackTrace() call?
parseStackTrace() calls 1 function(s): parseStackTraceFromString.
What calls parseStackTrace()?
parseStackTrace() is called by 1 function(s): extractLocationFromOwnerStack.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free