Praman — Agent-First SAP UI5 Test Automation Plugin - v1.2.0
    Preparing search index...

    Class AIError

    Error subclass for AI provider failures.

    AI provider failure context enabling LLM self-healing

    const error = new AIError({
    message: 'Provider unavailable',
    attempted: 'Generate test steps',
    provider: 'azure-openai',
    });

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new AIError instance.

      Parameters

      • options: AIErrorOptions

        AI error construction options including provider context.

      Returns AIError

      import { AIError } from '#core/errors/ai-error.js';

      const error = new AIError({
      message: 'Token limit exceeded for GPT-4o',
      attempted: 'Generate test steps from intent',
      provider: 'azure-openai',
      model: 'gpt-4o',
      tokenUsage: { prompt: 12000, completion: 0, total: 12000 },
      });

    Properties

    attempted: string
    code: ErrorCode
    details: Readonly<Record<string, unknown>>
    model: string | undefined
    provider: string | undefined
    retryable: boolean
    severity: "error" | "info" | "warning"
    suggestions: readonly string[]
    timestamp: string
    tokenUsage: TokenUsage | undefined

    Methods

    • Returns structured context for AI agents with provider diagnostics.

      Returns AIErrorContext & {
          model: string | undefined;
          provider: string | undefined;
          tokenUsage: TokenUsage | undefined;
      }

      Base AI context plus provider, model, and tokenUsage fields to enable LLM self-healing and retry decisions.

      const context = error.toAIContext();
      // context.provider, context.model, context.tokenUsage available
      // Send to LLM for provider fallback or token budget adjustment
    • Serializes the error to a JSON-safe object with AI provider fields.

      Returns SerializedPramanError & {
          model: string | undefined;
          provider: string | undefined;
          tokenUsage: TokenUsage | undefined;
      }

      Base fields plus provider, model, and tokenUsage.

      const json = error.toJSON();
      // json.provider === 'azure-openai'
      // json.model === 'gpt-4o'
      // json.tokenUsage === { prompt: 12000, completion: 0, total: 12000 }
    • Formats the error for human-readable console output.

      Returns string

      Multi-line formatted string with all diagnostic sections.

      console.error(error.toUserMessage());