Skip to content

Commit 033bc31

Browse files
flovilmartdrew-gross
authored andcommitted
Report validation errors with correct error code (#2299)
1 parent 40c4fcd commit 033bc31

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

spec/ParseAPI.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ describe('miscellaneous', function() {
10171017
fail('Validation should not have succeeded');
10181018
done();
10191019
}, (e) => {
1020-
expect(e.code).toEqual(141);
1020+
expect(e.code).toEqual(142);
10211021
expect(e.message).toEqual('Validation failed.');
10221022
done();
10231023
});

src/Routers/FunctionsRouter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class FunctionsRouter extends PromiseRouter {
7373
if (theValidator && typeof theValidator === "function") {
7474
var result = theValidator(request);
7575
if (!result) {
76-
throw new Parse.Error(Parse.Error.SCRIPT_FAILED, 'Validation failed.');
76+
throw new Parse.Error(Parse.Error.VALIDATION_ERROR, 'Validation failed.');
7777
}
7878
}
7979

0 commit comments

Comments
 (0)