Skip to content

Commit 438cf58

Browse files
committed
Fix early server response in Schema validation.
1 parent 98769a2 commit 438cf58

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Schema.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,12 @@ class Schema {
448448
geocount++;
449449
}
450450
if (geocount > 1) {
451-
throw new Parse.Error(
452-
Parse.Error.INCORRECT_TYPE,
453-
'there can only be one geopoint field in a class');
451+
// Make sure all field validation operations run before we return.
452+
// If not - we are continuing to run logic, but already provided response from the server.
453+
return promise.then(() => {
454+
return Promise.reject(new Parse.Error(Parse.Error.INCORRECT_TYPE,
455+
'there can only be one geopoint field in a class'));
456+
});
454457
}
455458
if (!expected) {
456459
continue;

0 commit comments

Comments
 (0)