Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | import * as color from 'src/ui/colors'; |
| 2 | import { formatCapturedError, formatTitle, interruptedMessage } from 'effect-errors/pretty-print'; |
| 3 | import { type PrettyPrintOptions, prettyPrintOptionsDefault } from 'effect-errors/types'; |
| 4 | |
| 5 | import type { CapturedErrors } from './capture-errors'; |
| 6 | |
| 7 | export const prettyPrintFromCapturedErrors = ( |
| 8 | { errors, interrupted }: CapturedErrors, |
| 9 | options: PrettyPrintOptions = prettyPrintOptionsDefault |
| 10 | ) => { |
| 11 | if (interrupted) { |
| 12 | return interruptedMessage; |
| 13 | } |
| 14 | |
| 15 | const title = formatTitle(errors.length); |
| 16 | const formattedFailures = errors.map(formatCapturedError(errors.length, options)); |
| 17 | |
| 18 | const message = [...title, ...formattedFailures].join('\r\n'); |
| 19 | return color.bgBlack(message); |
| 20 | }; |