mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 12:03:28 +08:00
Add error checking around user callbacks.
This commit is contained in:
parent
60fc61065e
commit
29549b835a
@ -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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user