Report validation errors with correct error code (#2299)
This commit is contained in:
@@ -1017,7 +1017,7 @@ describe('miscellaneous', function() {
|
|||||||
fail('Validation should not have succeeded');
|
fail('Validation should not have succeeded');
|
||||||
done();
|
done();
|
||||||
}, (e) => {
|
}, (e) => {
|
||||||
expect(e.code).toEqual(141);
|
expect(e.code).toEqual(142);
|
||||||
expect(e.message).toEqual('Validation failed.');
|
expect(e.message).toEqual('Validation failed.');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export class FunctionsRouter extends PromiseRouter {
|
|||||||
if (theValidator && typeof theValidator === "function") {
|
if (theValidator && typeof theValidator === "function") {
|
||||||
var result = theValidator(request);
|
var result = theValidator(request);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
throw new Parse.Error(Parse.Error.SCRIPT_FAILED, 'Validation failed.');
|
throw new Parse.Error(Parse.Error.VALIDATION_ERROR, 'Validation failed.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user