From bd0de57f3c3ace8d08f5ccc5b89ef5ae1966922c Mon Sep 17 00:00:00 2001 From: Ron Zeidman Date: Mon, 10 Oct 2016 16:02:41 +0300 Subject: [PATCH] Error object fix Source: https://github.com/hapijs/joi/blob/master/API.md#errors ## Errors Joi throws classical javascript `Error`s containing : - `name` - `'ValidationError'`. - `isJoi` - `true`. - `details` - an array of errors : - `message` - string with a description of the error. - `path` - dotted path to the key where the error happened. - `type` - type of the error. - `context` - object providing context of the error. - `annotate` - function that returns a string with an annotated version of the object pointing at the places where errors occured. - `_object` - the original object to validate. --- joi/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/joi/index.d.ts b/joi/index.d.ts index ece6bb6d62..0b2cf1e8cb 100644 --- a/joi/index.d.ts +++ b/joi/index.d.ts @@ -121,17 +121,17 @@ export interface IPOptions { } export interface ValidationError extends Error { - message: string; + isJoi: boolean; details: ValidationErrorItem[]; - simple(): string; - annotated(): string; + annotate(): string; + _object: any; } export interface ValidationErrorItem { message: string; type: string; path: string; - options?: ValidationOptions; + context?: any; } export interface ValidationResult {