(frame: StackFrame)
| 441 | } |
| 442 | |
| 443 | const currentStackTrace = (frame: StackFrame): string => { |
| 444 | const out: Array<string> = [] |
| 445 | let current: StackFrame | undefined = frame |
| 446 | let i = 0 |
| 447 | while (current && i < 10) { |
| 448 | const stack = current.stack() |
| 449 | if (stack) { |
| 450 | const locationMatchAll = stack.matchAll(locationRegExp) |
| 451 | let match = false |
| 452 | for (const [, location] of locationMatchAll) { |
| 453 | match = true |
| 454 | out.push(` at ${current.name} (${location})`) |
| 455 | } |
| 456 | if (!match) { |
| 457 | out.push(` at ${current.name} (${stack.replace(/^at /, "")})`) |
| 458 | } |
| 459 | } else { |
| 460 | out.push(` at ${current.name}`) |
| 461 | } |
| 462 | current = current.parent |
| 463 | i++ |
| 464 | } |
| 465 | return out.join("\n") |
| 466 | } |
| 467 | |
| 468 | /** @internal */ |
| 469 | export const causePretty = <E>(cause: Cause.Cause<E>): string => |
no test coverage detected