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.
This commit is contained in:
Ron Zeidman
2016-10-10 16:02:41 +03:00
committed by GitHub
parent 93a1245129
commit bd0de57f3c
+4 -4
View File
@@ -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<T> {