UNPKG

venice-ai-sdk-apl

Version:

A comprehensive SDK for the Venice AI API with CLI support, programmatic CLI usage, CLI-style interface, and interactive demo

37 lines 1.01 kB
"use strict"; /** * API Error class * * This class represents errors returned by the Venice AI API. * It includes information about the error such as the status code, * error code, and message. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.ApiError = void 0; /** * API Error class */ class ApiError extends Error { /** * Creates a new API error * * @param options - Error options */ constructor(options) { super(options.message); this.name = 'ApiError'; this.status = options.status; this.code = options.code; this.data = options.data; // This is needed for proper instanceof checks in TypeScript Object.setPrototypeOf(this, ApiError.prototype); } /** * Returns a string representation of the error */ toString() { return `${this.name}: [${this.code}] ${this.message} (${this.status})`; } } exports.ApiError = ApiError; //# sourceMappingURL=api-error.js.map