import Joi from "joi"; import BaseException from "../base.exception"; /** * @fileoverview Validation exception (HTTP 422) * @author dr. Salmi */ /** * Exception thrown when input validation fails. * Corresponds to HTTP 422 Unprocessable Entity status code. * Supports both Joi validation errors and custom field errors. * * @class ValidationException * @extends {BaseException} * @example * ```typescript * // With custom field errors * throw new ValidationException('Validation failed', { * email: { value: 'invalid-email', message: 'Email format is invalid' } * }); * * // With Joi validation error * throw new ValidationException('Validation failed', joiValidationError); * ``` */ declare class ValidationException extends BaseException { /** * Field-specific validation errors * @type {ErrorFields} */ readonly fields: ErrorFields; /** * Indicates if this exception was created from a Joi validation error * @type {boolean} */ readonly isJoi: boolean; /** * Indicates if this exception was created from a Mongoose validation error * @type {boolean} */ readonly isMongoose: boolean; /** * Indicates if this exception was created from a Celebrate validation error * @type {boolean} */ readonly isCelebrate: boolean; /** * Creates an instance of ValidationException. * * @param {string} [message='Validation failed'] - The error message * @param {ErrorFields | Joi.ValidationError} [fields={}] - Field errors or Joi validation error * @param {Record} [context] - Additional context * @memberof ValidationException */ constructor(message?: string, fields?: ErrorFields | Joi.ValidationError, context?: Record); /** * Returns a JSON representation of the validation exception * * @returns {object} JSON representation including field errors * @memberof ValidationException */ toJSON(): object; } export default ValidationException;