Member Junction
    Preparing search index...

    Utility class for analyzing errors from various AI providers and mapping them to standardized error information. This class provides a consistent way to interpret errors across different provider SDKs.

    ErrorAnalyzer

    2.47.0

    try {
    const result = await provider.chat(params);
    } catch (error) {
    const errorInfo = ErrorAnalyzer.analyzeError(error, 'OpenAI');
    if (errorInfo.canFailover) {
    // Try another provider
    }
    }
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Analyzes an error from an AI provider and returns standardized error information. This method extracts relevant details from provider-specific error formats and maps them to a consistent structure for easier handling.

      Parameters

      • error: any

        The error object thrown by the provider SDK

      • OptionalproviderName: string

        Optional name of the provider for context

      Returns AIErrorInfo

      Standardized error information

      const errorInfo = ErrorAnalyzer.analyzeError(error, 'Anthropic');
      console.log(`Error type: ${errorInfo.errorType}`);
      console.log(`Can retry: ${errorInfo.severity !== 'Fatal'}`);