@mastra/core
Version:
16 lines • 1.2 kB
TypeScript
export type ProviderFailureKind = 'auth' | 'quota' | 'rate_limited' | 'context_overflow' | 'model_rejected' | 'tool_history_rejected' | 'timeout' | 'unavailable' | 'invalid_request' | 'unknown';
export interface ProviderErrorFacts {
statusCode?: number;
codes?: string[];
/** The innermost sentence behind HTTP phrases, envelopes, stringified layers and a wrapped provider response, when it differs from the message. */
reason?: string;
}
export declare const PROVIDER_CALL_ERROR_NAME: RegExp;
export declare function classifyProviderError(error: unknown): ProviderFailureKind;
/** The JSON-safe facts worth carrying next to a failure's name and message, on the wire and in history. */
export declare function providerErrorFacts(error: unknown): ProviderErrorFacts;
/** The innermost sentence a provider wrote for a person, unwrapped from envelopes, stringified layers and a wrapped provider response. */
export declare function providerErrorReason(error: unknown): string | undefined;
export declare function providerRequestId(error: unknown): string | undefined;
export declare function providerModelId(error: unknown): string | undefined;
//# sourceMappingURL=provider-error.d.ts.map