Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 04:45 UTC
| 1 | import { formatErrorTitle, maybeWarnAboutPlainStrings } from 'effect-errors/pretty-print/common'; |
| 2 | import type { PrettyPrintOptions } from 'effect-errors/types'; |
| 3 | |
| 4 | import type { ErrorData } from '../capture-errors'; |
| 5 | import { |
| 6 | maybeAdviseSpansUsage, |
| 7 | maybePrintNodeStacktrace, |
| 8 | maybePrintSpansTimeline, |
| 9 | printEffectStacktrace, |
| 10 | } from './captured-errors'; |
| 11 | |
| 12 | export const formatCapturedError = |
| 13 | (failuresCount: number, options: PrettyPrintOptions) => |
| 14 | ({ errorType, message, stack, spans, sources, isPlainString }: ErrorData, index: number) => { |
| 15 | const title = formatErrorTitle(errorType, message, failuresCount, index); |
| 16 | const plainStringWarning = maybeWarnAboutPlainStrings(isPlainString); |
| 17 | const spansTimeline = maybePrintSpansTimeline(spans, isPlainString, options); |
| 18 | const spansUsageAdvice = maybeAdviseSpansUsage(spans); |
| 19 | |
| 20 | const effectStacktrace = printEffectStacktrace(sources, spans, options); |
| 21 | const nodeStacktrace = maybePrintNodeStacktrace(stack, isPlainString, options); |
| 22 | |
| 23 | return [ |
| 24 | ...title, |
| 25 | ...plainStringWarning, |
| 26 | ...spansTimeline, |
| 27 | ...spansUsageAdvice, |
| 28 | '', |
| 29 | ...effectStacktrace, |
| 30 | ...nodeStacktrace, |
| 31 | '', |
| 32 | ].join(' \r\n'); |
| 33 | }; |