Skip to content

Commit

Permalink
Nicer JSON validation msg
Browse files Browse the repository at this point in the history
  • Loading branch information
ritave committed Nov 7, 2022
1 parent 4a67c5b commit 9ea19be
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('json', () => {
it('returns error message', () => {
const [error] = validate(undefined, JsonStruct);
assert(error !== undefined);
expect(error.message).toStrictEqual('Expected valid JSON value');
expect(error.message).toStrictEqual('Expected a valid JSON-serializable value');
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
export const JsonStruct = define<Json>('Json', (value) => {
const [isValid] = validateJsonAndGetSize(value, true);
if (!isValid) {
return 'Expected valid JSON value';
return 'Expected a valid JSON-serializable value';
}
return true;
});
Expand Down

0 comments on commit 9ea19be

Please sign in to comment.