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
43 lines • 1.26 kB
JavaScript
;
/**
* Validation Error class
*
* This class represents validation errors that occur when validating
* input parameters before making API requests.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidationError = void 0;
/**
* Validation Error class
*/
class ValidationError extends Error {
/**
* Creates a new validation error
*
* @param options - Error options
*/
constructor(options) {
super(options.message);
this.name = 'ValidationError';
this.field = options.field;
this.expected = options.expected;
this.actual = options.actual;
// This is needed for proper instanceof checks in TypeScript
Object.setPrototypeOf(this, ValidationError.prototype);
}
/**
* Returns a string representation of the error
*/
toString() {
let message = `${this.name}: ${this.message}`;
if (this.field) {
message += ` (field: ${this.field})`;
}
if (this.expected && this.actual) {
message += ` - expected ${this.expected}, got ${this.actual}`;
}
return message;
}
}
exports.ValidationError = ValidationError;
//# sourceMappingURL=validation-error.js.map