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

Function generate

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

Source from the content-addressed store, hash-verified

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

Callers 1

fFunction · 0.85

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected