MCPcopy Create free account
hub / github.com/effect-app/libs / addSpanStackTrace

Function addSpanStackTrace

repos/effect/packages/effect/src/internal/tracer.ts:9–25  ·  view source on GitHub ↗
(
  options: A | undefined
)

Source from the content-addressed store, hash-verified

7
8/** @internal */
9export const addSpanStackTrace = <A extends Tracer.TraceOptions>(
10 options: A | undefined
11): A => {
12 if (options?.captureStackTrace === false) {
13 return options
14 } else if (options?.captureStackTrace !== undefined && typeof options.captureStackTrace !== "boolean") {
15 return options
16 }
17 const limit = getStackTraceLimit()
18 setStackTraceLimit(3)
19 const traceError = new Error()
20 setStackTraceLimit(limit)
21 return {
22 ...options,
23 captureStackTrace: spanCleaner(() => traceError.stack)
24 } as A
25}
26
27/** @internal */
28export const makeStackCleaner = (line: number) => (stack: () => string | undefined): () => string | undefined => {

Callers 3

Channel.tsFile · 0.90
Stream.tsFile · 0.90
effect.tsFile · 0.90

Calls 2

getStackTraceLimitFunction · 0.90
setStackTraceLimitFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…