MCPcopy Create free account
hub / github.com/effect-app/libs / cleanErrorStack

Function cleanErrorStack

repos/effect/packages/effect/src/internal/effect.ts:399–414  ·  view source on GitHub ↗
(
  stack: string,
  error: Error,
  annotations: ReadonlyMap<string, unknown> | undefined
)

Source from the content-addressed store, hash-verified

397 return u.toString()
398 } catch {
399 // something's off, rollback to json
400 }
401 }
402 return formatJson(u)
403}
404
405const locationRegExp = /\((.*)\)/g
406
407const cleanErrorStack = (
408 stack: string,
409 error: Error,
410 annotations: ReadonlyMap<string, unknown> | undefined
411): string => {
412 const message = `${error.name}: ${error.message}`
413 const lines = (stack.startsWith(message) ? stack.slice(message.length) : stack).split("\n")
414 const out: Array<string> = [message]
415 for (let i = 1; i < lines.length; i++) {
416 if (/(?:Generator\.next|~effect\/Effect)/.test(lines[i])) {
417 break

Callers 1

causePrettyErrorFunction · 0.85

Calls 4

addStackAnnotationsFunction · 0.85
pushMethod · 0.80
joinMethod · 0.80
splitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…