Skip to content

Commit bb7907e

Browse files
committed
fix(query): make #get param check more consistent
1 parent 3cea1ff commit bb7907e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/query.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,13 @@ module.exports = function(AV) {
183183
* @return {Promise.<AV.Object>}
184184
*/
185185
get: function(objectId, options) {
186-
if (!objectId) {
187-
var errorObject = new AVError(
188-
AVError.OBJECT_NOT_FOUND,
189-
'Object not found.'
186+
if (!_.isString(objectId)) {
187+
throw new Error('objectId must be a string');
188+
}
189+
if (objectId === '') {
190+
return Promise.reject(
191+
new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.')
190192
);
191-
throw errorObject;
192193
}
193194

194195
var obj = this._newObject();

0 commit comments

Comments
 (0)