diff --git a/README.md b/README.md index 7878a9012..a3dcd72fe 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,6 @@ const parsedUser = await userSchema.validate( - - [Schema basics](#schema-basics) - [Parsing: Transforms](#parsing-transforms) - [Validation: Tests](#validation-tests) diff --git a/src/ValidationError.ts b/src/ValidationError.ts index e84c56f5d..9fce36f3a 100644 --- a/src/ValidationError.ts +++ b/src/ValidationError.ts @@ -5,10 +5,7 @@ let strReg = /\$\{\s*(\w+)\s*\}/g; type Params = Record; -export default class ValidationError implements Error { - name: string; - message: string; - stack?: string | undefined; +export default class ValidationError extends Error { value: any; path?: string; type?: string; @@ -43,6 +40,8 @@ export default class ValidationError implements Error { type?: string, disableStack?: boolean, ) { + super(); + this.name = 'ValidationError'; this.value = value; this.path = field;