UNPKG

714 BTypeScriptView Raw
1import { AppError, ErrorData } from '@naturalcycles/js-lib';
2import { ValidationErrorItem } from 'joi';
3/**
4 * Example of ValidationErrorItem:
5 *
6 * {
7 * message: '"temperature" must be larger than or equal to 33',
8 * path: [ 'entries', 10, 'temperature' ],
9 * type: 'number.min',
10 * context: { limit: 33, value: 30, key: 'temperature', label: 'temperature' }
11 * }
12 */
13export interface JoiValidationErrorData extends ErrorData {
14 joiValidationErrorItems: ValidationErrorItem[];
15 joiValidationObjectName?: string;
16 joiValidationObjectId?: string;
17}
18export declare class JoiValidationError extends AppError<JoiValidationErrorData> {
19 constructor(message: string, data: JoiValidationErrorData);
20}