import { HttpStatus } from '@nestjs/common'; import { ValidationError } from 'class-validator'; import { HandledException } from '../exceptions/custom.exception'; import { RESTError } from '../models/wrappers/rest-wrapper.class'; function validationExceptionFactory(_errors: ValidationError[]): HandledException { const error = new RESTError('DATA_VALIDATION'); _errors.forEach((i: any) => { error.validation = i; }); return new HandledException([error], HttpStatus.UNPROCESSABLE_ENTITY); } export { validationExceptionFactory };