change error msg
This commit is contained in:
@@ -350,11 +350,7 @@ describe('Parse.Object testing', () => {
|
|||||||
var next = function(index) {
|
var next = function(index) {
|
||||||
if (index < tests.length) {
|
if (index < tests.length) {
|
||||||
tests[index].save().then(fail, error => {
|
tests[index].save().then(fail, error => {
|
||||||
if (types[index] === 'Pointer') {
|
expect(error.code).toEqual(Parse.Error.INCORRECT_TYPE);
|
||||||
expect(error.code).toEqual(Parse.Error.INVALID_POINTER);
|
|
||||||
} else {
|
|
||||||
expect(error.code).toEqual(Parse.Error.INCORRECT_TYPE);
|
|
||||||
}
|
|
||||||
next(index + 1);
|
next(index + 1);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -737,34 +737,33 @@ function getObjectType(obj) {
|
|||||||
if(obj.className) {
|
if(obj.className) {
|
||||||
return '*' + obj.className;
|
return '*' + obj.className;
|
||||||
} else {
|
} else {
|
||||||
throw new Parse.Error(Parse.Error.INVALID_POINTER, JSON.stringify(obj) + " is not a valid Pointer");
|
throw new Parse.Error(Parse.Error.INCORRECT_TYPE, "This is not a valid "+obj.__type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'File' :
|
case 'File' :
|
||||||
if(obj.name) {
|
if(obj.name) {
|
||||||
return 'file';
|
return 'file';
|
||||||
} else {
|
} else {
|
||||||
let msg = obj.name? JSON.stringify(obj) + " is not a valid File" : "File has no name";
|
throw new Parse.Error(Parse.Error.INCORRECT_TYPE, "This is not a valid "+obj.__type);
|
||||||
throw new Parse.Error(Parse.Error.INCORRECT_TYPE, msg);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Date' :
|
case 'Date' :
|
||||||
if(obj.iso) {
|
if(obj.iso) {
|
||||||
return 'date';
|
return 'date';
|
||||||
} else {
|
} else {
|
||||||
throw new Parse.Error(Parse.Error.INCORRECT_TYPE, JSON.stringify(obj) + " is not a valid Date");
|
throw new Parse.Error(Parse.Error.INCORRECT_TYPE, "This is not a valid "+obj.__type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'GeoPoint' :
|
case 'GeoPoint' :
|
||||||
if(obj.latitude != null && obj.longitude != null) {
|
if(obj.latitude != null && obj.longitude != null) {
|
||||||
return 'geopoint';
|
return 'geopoint';
|
||||||
} else {
|
} else {
|
||||||
throw new Parse.Error(Parse.Error.INCORRECT_TYPE, JSON.stringify(obj) + " is not a valid GeoPoint");
|
throw new Parse.Error(Parse.Error.INCORRECT_TYPE, "This is not a valid "+obj.__type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Bytes' :
|
case 'Bytes' :
|
||||||
if(!obj.base64) {
|
if(!obj.base64) {
|
||||||
throw new Parse.Error(Parse.Error.INCORRECT_TYPE, 'Bytes type has no base64 field: ' + JSON.stringify(obj));
|
throw new Parse.Error(Parse.Error.INCORRECT_TYPE, "This is not a valid "+obj.__type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
|
|||||||
Reference in New Issue
Block a user