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

Function serviceNotFoundError

packages/effect/src/Context.ts:1241–1254  ·  view source on GitHub ↗
(service: Key<any, any>)

Source from the content-addressed store, hash-verified

1239 hasProperty(u, ServiceNotFoundErrorTypeId)
1240
1241const serviceNotFoundError = (service: Key<any, any>): ServiceNotFoundError => {
1242 const error = Object.assign(
1243 new Error(`Service not found${service.key ? `: ${service.key}` : ""}`),
1244 { key: service.key }
1245 )
1246 // Non-enumerable so the marker stays out of printed errors
1247 Object.defineProperty(error, ServiceNotFoundErrorTypeId, { value: ServiceNotFoundErrorTypeId })
1248 if (error.stack) {
1249 const lines = error.stack.split("\n")
1250 lines.splice(1, 3)
1251 error.stack = lines.join("\n")
1252 }
1253 return error as ServiceNotFoundError
1254}
1255
1256/**
1257 * Gets the service for a key safely wrapped in an `Option`.

Callers 1

Context.tsFile · 0.85

Calls 3

assignMethod · 0.80
splitMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected