From 438cf58d4c436f8480fa7ac74b2d7edfc05d2f66 Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Mon, 7 Mar 2016 22:45:46 -0800 Subject: [PATCH] Fix early server response in Schema validation. --- src/Schema.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Schema.js b/src/Schema.js index 3e25b09d..13ccb7cd 100644 --- a/src/Schema.js +++ b/src/Schema.js @@ -448,9 +448,12 @@ class Schema { geocount++; } if (geocount > 1) { - throw new Parse.Error( - Parse.Error.INCORRECT_TYPE, - 'there can only be one geopoint field in a class'); + // Make sure all field validation operations run before we return. + // If not - we are continuing to run logic, but already provided response from the server. + return promise.then(() => { + return Promise.reject(new Parse.Error(Parse.Error.INCORRECT_TYPE, + 'there can only be one geopoint field in a class')); + }); } if (!expected) { continue;