UNPKG

@nomyx/assistant

Version:

A powerful assistant library and cli for your AI projects. works with Vertex AI (Claude and Gemini)

24 lines (20 loc) 616 B
import { AxiosError } from 'axios'; export class AnthropicProviderError extends Error { constructor(message: string, public statusCode?: number, public response?: any) { super(message); this.name = 'AnthropicProviderError'; } } export function handleAnthropicError(error: unknown): AnthropicProviderError { if (error instanceof AnthropicProviderError) { return error; } if (error instanceof AxiosError) { return new AnthropicProviderError( error.message, error.response?.status, error.response?.data ); } return new AnthropicProviderError(String(error)); }