MCPcopy Index your code
hub / github.com/react/create-react-app / parseError

Function parseError

packages/react-error-overlay/src/utils/parser.js:75–89  ·  view source on GitHub ↗

* Turns an Error , or similar object, into a set of StackFrame s. * @alias parse

(error: Error | string | string[])

Source from the content-addressed store, hash-verified

73 * @alias parse
74 */
75function parseError(error: Error | string | string[]): StackFrame[] {
76 if (error == null) {
77 throw new Error('You cannot pass a null object.');
78 }
79 if (typeof error === 'string') {
80 return parseStack(error.split('\n'));
81 }
82 if (Array.isArray(error)) {
83 return parseStack(error);
84 }
85 if (typeof error.stack === 'string') {
86 return parseStack(error.stack.split('\n'));
87 }
88 throw new Error('The error you provided does not contain a stack trace.');
89}
90
91export { parseError as parse };
92export default parseError;

Callers

nothing calls this directly

Calls 1

parseStackFunction · 0.70

Tested by

no test coverage detected