MCPcopy Create free account
hub / github.com/Effect-TS/effect / currentStackTrace

Function currentStackTrace

packages/effect/src/internal/effect.ts:443–466  ·  view source on GitHub ↗
(frame: StackFrame)

Source from the content-addressed store, hash-verified

441}
442
443const 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 */
469export const causePretty = <E>(cause: Cause.Cause<E>): string =>

Callers 2

addStackAnnotationsFunction · 0.85
interruptCauseStackFunction · 0.85

Calls 3

pushMethod · 0.80
joinMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected