From b015db32523e14ef337bd6b9b2d59f70e0fbbecf Mon Sep 17 00:00:00 2001 From: Florent Vilmart Date: Tue, 19 Jul 2016 02:03:43 -0400 Subject: [PATCH] Report validation errors with correct error code (#2299) --- spec/ParseAPI.spec.js | 2 +- src/Routers/FunctionsRouter.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/ParseAPI.spec.js b/spec/ParseAPI.spec.js index 1693a86c6a..814cbb0aee 100644 --- a/spec/ParseAPI.spec.js +++ b/spec/ParseAPI.spec.js @@ -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(); }); diff --git a/src/Routers/FunctionsRouter.js b/src/Routers/FunctionsRouter.js index 197536654b..c8e82353b7 100644 --- a/src/Routers/FunctionsRouter.js +++ b/src/Routers/FunctionsRouter.js @@ -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.'); } }