mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 03:53:09 +08:00
Add error checking around user callbacks.
This commit is contained in:
parent
60fc61065e
commit
29549b835a
@ -95,7 +95,12 @@ Camera.prototype.getPicture = function(successCallback, errorCallback, options)
|
|||||||
*/
|
*/
|
||||||
Camera.prototype.success = function(picture) {
|
Camera.prototype.success = function(picture) {
|
||||||
if (this.successCallback) {
|
if (this.successCallback) {
|
||||||
this.successCallback(picture);
|
try {
|
||||||
|
this.successCallback(picture);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.log("Camera error calling user's success callback: " + e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -107,7 +112,12 @@ Camera.prototype.success = function(picture) {
|
|||||||
*/
|
*/
|
||||||
Camera.prototype.error = function(err) {
|
Camera.prototype.error = function(err) {
|
||||||
if (this.errorCallback) {
|
if (this.errorCallback) {
|
||||||
this.errorCallback(err);
|
try {
|
||||||
|
this.errorCallback(err);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.log("Camera error calling user's error callback: " + e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user