@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
22 lines (21 loc) • 756 B
TypeScript
/// <reference types="hapi__joi" />
import { ValidationErrorItem } from '@hapi/joi';
import { AppError, ErrorData } from '@naturalcycles/js-lib';
/**
* Example of ValidationErrorItem:
*
* {
* message: '"temperature" must be larger than or equal to 33',
* path: [ 'entries', 10, 'temperature' ],
* type: 'number.min',
* context: { limit: 33, value: 30, key: 'temperature', label: 'temperature' }
* }
*/
export interface JoiValidationErrorData extends ErrorData {
joiValidationErrorItems: ValidationErrorItem[];
joiValidationObjectName?: string;
joiValidationObjectId?: string;
}
export declare class JoiValidationError extends AppError<JoiValidationErrorData> {
constructor(message: string, data: JoiValidationErrorData);
}