Skip to content

Commit

Permalink
fix: ValidationError extends Error
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Sep 25, 2023
1 parent 9c1208c commit bc5121b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ const parsedUser = await userSchema.validate(
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->


- [Schema basics](#schema-basics)
- [Parsing: Transforms](#parsing-transforms)
- [Validation: Tests](#validation-tests)
Expand Down
7 changes: 3 additions & 4 deletions src/ValidationError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ let strReg = /\$\{\s*(\w+)\s*\}/g;

type Params = Record<string, unknown>;

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;
Expand Down Expand Up @@ -43,6 +40,8 @@ export default class ValidationError implements Error {
type?: string,
disableStack?: boolean,
) {
super();

this.name = 'ValidationError';
this.value = value;
this.path = field;
Expand Down

0 comments on commit bc5121b

Please sign in to comment.