Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

518 B
Raw Blame
import { isNil, tryParseFriendlyPieceError } from '@activepieces/core-utils'

export function summarizeEngineError({ error }: { error: string | undefined }): string | undefined {
    if (isNil(error)) {
        return undefined
    }
    const parsed = tryParseFriendlyPieceError(error)
    const summary = isNil(parsed)
        ? error
        : [parsed.errorName, parsed.message].filter((part) => !isNil(part)).join(': ')
    return summary.slice(0, MAX_ERROR_SUMMARY_LENGTH)
}

const MAX_ERROR_SUMMARY_LENGTH = 500