Skip to content

Commit

Permalink
Report validation errors with correct error code (parse-community#2299)
Browse files Browse the repository at this point in the history
  • Loading branch information
flovilmart authored and Rafael Santos committed Mar 16, 2017
1 parent 1535743 commit b015db3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spec/ParseAPI.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ describe('miscellaneous', function() {
fail('Validation should not have succeeded');
done();
}, (e) => {
expect(e.code).toEqual(141);
expect(e.code).toEqual(142);
expect(e.message).toEqual('Validation failed.');
done();
});
Expand Down
2 changes: 1 addition & 1 deletion src/Routers/FunctionsRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class FunctionsRouter extends PromiseRouter {
if (theValidator && typeof theValidator === "function") {
var result = theValidator(request);
if (!result) {
throw new Parse.Error(Parse.Error.SCRIPT_FAILED, 'Validation failed.');
throw new Parse.Error(Parse.Error.VALIDATION_ERROR, 'Validation failed.');
}
}

Expand Down

0 comments on commit b015db3

Please sign in to comment.