MCPcopy Index your code
hub / github.com/Effect-TS/effect / constructor

Function constructor

packages/effect/src/Micro.ts:256–289  ·  view source on GitHub ↗
(
    readonly _tag: Tag,
    originalError: unknown,
    readonly traces: ReadonlyArray<string>
  )

Source from the content-addressed store, hash-verified

254 _E: Covariant<E>
255 }
256 constructor(
257 readonly _tag: Tag,
258 originalError: unknown,
259 readonly traces: ReadonlyArray<string>
260 ) {
261 const causeName = `MicroCause.${_tag}`
262 let name: string
263 let message: string
264 let stack: string
265 if (originalError instanceof globalThis.Error) {
266 name = `(${causeName}) ${originalError.name}`
267 message = originalError.message as string
268 const messageLines = message.split("\n").length
269 stack = originalError.stack
270 ? `(${causeName}) ${
271 originalError.stack
272 .split("\n")
273 .slice(0, messageLines + 3)
274 .join("\n")
275 }`
276 : `${name}: ${message}`
277 } else {
278 name = causeName
279 message = toStringUnknown(originalError, 0)
280 stack = `${name}: ${message}`
281 }
282 if (traces.length > 0) {
283 stack += `\n ${traces.join("\n ")}`
284 }
285 super(message)
286 this[MicroCauseTypeId] = microCauseVariance
287 this.name = name
288 this.stack = stack
289 }
290 pipe() {
291 return pipeArguments(this, arguments)
292 }

Callers

nothing calls this directly

Calls 3

toStringUnknownFunction · 0.85
splitMethod · 0.80
joinMethod · 0.65

Tested by

no test coverage detected