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

Function serviceNotFoundError

packages/effect/src/internal/context.ts:172–189  ·  view source on GitHub ↗
(tag: C.Tag<any, any>)

Source from the content-addressed store, hash-verified

170}
171
172const serviceNotFoundError = (tag: C.Tag<any, any>) => {
173 const error = new Error(`Service not found${tag.key ? `: ${String(tag.key)}` : ""}`)
174 if (tag.stack) {
175 const lines = tag.stack.split("\n")
176 if (lines.length > 2) {
177 const afterAt = lines[2].match(/at (.*)/)
178 if (afterAt) {
179 error.message = error.message + ` (defined at ${afterAt[1]})`
180 }
181 }
182 }
183 if (error.stack) {
184 const lines = error.stack.split("\n")
185 lines.splice(1, 3)
186 error.stack = lines.join("\n")
187 }
188 return error
189}
190
191/** @internal */
192export const isContext = (u: unknown): u is C.Context<never> => hasProperty(u, TypeId)

Callers 1

context.tsFile · 0.85

Calls 3

StringInterface · 0.85
splitMethod · 0.80
joinMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…