Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

730 B
Raw Blame
import * as color from 'src/ui/colors';
import { formatCapturedError, formatTitle, interruptedMessage } from 'effect-errors/pretty-print';
import { type PrettyPrintOptions, prettyPrintOptionsDefault } from 'effect-errors/types';

import type { CapturedErrors } from './capture-errors';

export const prettyPrintFromCapturedErrors = (
  { errors, interrupted }: CapturedErrors,
  options: PrettyPrintOptions = prettyPrintOptionsDefault
) => {
  if (interrupted) {
    return interruptedMessage;
  }

  const title = formatTitle(errors.length);
  const formattedFailures = errors.map(formatCapturedError(errors.length, options));

  const message = [...title, ...formattedFailures].join('\r\n');
  return color.bgBlack(message);
};