* Turns an Error , or similar object, into a set of StackFrame s. * @alias parse
(error: Error | string | string[])
| 73 | * @alias parse |
| 74 | */ |
| 75 | function 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 | |
| 91 | export { parseError as parse }; |
| 92 | export default parseError; |
nothing calls this directly
no test coverage detected