Add error checking around user callbacks.

This commit is contained in:
Bryce Curtis 2010-10-18 16:04:39 -05:00
parent 60fc61065e
commit 29549b835a

View File

@ -95,8 +95,13 @@ Camera.prototype.getPicture = function(successCallback, errorCallback, options)
*/ */
Camera.prototype.success = function(picture) { Camera.prototype.success = function(picture) {
if (this.successCallback) { if (this.successCallback) {
try {
this.successCallback(picture); this.successCallback(picture);
} }
catch (e) {
console.log("Camera error calling user's success callback: " + e);
}
}
}; };
/** /**
@ -107,8 +112,13 @@ Camera.prototype.success = function(picture) {
*/ */
Camera.prototype.error = function(err) { Camera.prototype.error = function(err) {
if (this.errorCallback) { if (this.errorCallback) {
try {
this.errorCallback(err); this.errorCallback(err);
} }
catch (e) {
console.log("Camera error calling user's error callback: " + e);
}
}
}; };
PhoneGap.addConstructor(function() { PhoneGap.addConstructor(function() {