mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
Add error checking around user callbacks.
This commit is contained in:
@@ -95,8 +95,13 @@ Camera.prototype.getPicture = function(successCallback, errorCallback, options)
|
||||
*/
|
||||
Camera.prototype.success = function(picture) {
|
||||
if (this.successCallback) {
|
||||
try {
|
||||
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) {
|
||||
if (this.errorCallback) {
|
||||
try {
|
||||
this.errorCallback(err);
|
||||
}
|
||||
catch (e) {
|
||||
console.log("Camera error calling user's error callback: " + e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PhoneGap.addConstructor(function() {
|
||||
|
||||
Reference in New Issue
Block a user