MCPcopy
hub / github.com/Effect-TS/effect / generate

Function generate

packages/effect/src/Micro.ts:2991–3002  ·  view source on GitHub ↗
(name: string, cause: MicroCause<any>)

Source from the content-addressed store, hash-verified

2989 const error = new globalThis.Error()
2990 globalThis.Error.stackTraceLimit = prevLimit
2991 function generate(name: string, cause: MicroCause<any>) {
2992 const stack = error.stack
2993 if (!stack) {
2994 return cause
2995 }
2996 const line = stack.split("\n")[2]?.trim().replace(/^at /, "")
2997 if (!line) {
2998 return cause
2999 }
3000 const lineMatch = line.match(/\((.*)\)$/)
3001 return causeWithTrace(cause, `at ${name} (${lineMatch ? lineMatch[1] : line})`)
3002 }
3003 const f = (name: string) => (self: Micro<any, any, any>) => onError(self, (cause) => failCause(generate(name, cause)))
3004 if (arguments.length === 2) {
3005 return f(arguments[1])(arguments[0])

Callers 1

fFunction · 0.85

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected