/**
 * Validation error is a superset of Error class with validation
 * error messages
 */
export class ValidationError extends Error {
    messages;
    /**
     * Http status code for the validation error
     */
    status = 422;
    /**
     * Internal code for handling the validation error
     * exception
     */
    code = 'E_VALIDATION_ERROR';
    constructor(messages, options) {
        const msg = options?.message || 'Validation failure';
        super(msg, options);
        this.messages = messages;
        const ErrorConstructor = this.constructor;
        if ('captureStackTrace' in Error) {
            Error.captureStackTrace(this, ErrorConstructor);
        }
    }
    get [Symbol.toStringTag]() {
        return this.constructor.name;
    }
    toString() {
        return `${this.name} [${this.code}]: ${this.message}`;
    }
}
//# sourceMappingURL=validation_error.js.map