-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): Added optional
longError
option to isValid()
Depending on use, violations reportd by isValid are either serialized or used as an object. This flag provides caller control on how much information is put into the error message, allowing for minimal and clean errors when the errors are being processed, and convenience in dumping all violations to console when that is more appropriate. Turns out, this code was being repeated in each use of the API. This refactoring just mirrors real use.
- Loading branch information
sramam
committed
Nov 20, 2017
1 parent
b9e63ba
commit df56bd0
Showing
4 changed files
with
63 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
export declare class SchemaError extends Error { | ||
_errors: Array<object>; | ||
constructor(message: any, errors: any); | ||
_serialized: string; | ||
constructor(message: any, errors: any, long?: boolean); | ||
readonly errors: object[]; | ||
serialize(): string; | ||
} | ||
export declare const isValid: (schema: any, data?: any) => Promise<boolean>; | ||
export declare const isValid: (schema: any, data?: any, longError?: boolean) => Promise<boolean>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters