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

Function serviceNotFoundError

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

Source from the content-addressed store, hash-verified

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