( stack: string, error: Error, annotations: ReadonlyMap<string, unknown> | undefined )
| 405 | const locationRegExp = /\((.*)\)/g |
| 406 | |
| 407 | const 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 |
| 418 | } |
| 419 | out.push(lines[i]) |
| 420 | } |
| 421 | return annotations ? addStackAnnotations(out.join("\n"), annotations) : out.join("\n") |
| 422 | } |
| 423 | |
| 424 | const addStackAnnotations = (stack: string, annotations: ReadonlyMap<string, unknown>) => { |
| 425 | const frame = annotations?.get(CauseStackTrace.key) as StackFrame | undefined |
no test coverage detected