@nomyx/assistant
Version:
A powerful assistant library and cli for your AI projects. works with Vertex AI (Claude and Gemini)
24 lines (23 loc) • 837 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AnthropicProviderError = void 0;
exports.handleAnthropicError = handleAnthropicError;
const axios_1 = require("axios");
class AnthropicProviderError extends Error {
constructor(message, statusCode, response) {
super(message);
this.statusCode = statusCode;
this.response = response;
this.name = 'AnthropicProviderError';
}
}
exports.AnthropicProviderError = AnthropicProviderError;
function handleAnthropicError(error) {
if (error instanceof AnthropicProviderError) {
return error;
}
if (error instanceof axios_1.AxiosError) {
return new AnthropicProviderError(error.message, error.response?.status, error.response?.data);
}
return new AnthropicProviderError(String(error));
}