From 29549b835a0d680d2ea64ee0ddd2ef453b1d7269 Mon Sep 17 00:00:00 2001 From: Bryce Curtis Date: Mon, 18 Oct 2010 16:04:39 -0500 Subject: [PATCH] Add error checking around user callbacks. --- framework/assets/js/camera.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/framework/assets/js/camera.js b/framework/assets/js/camera.js index 9a71be01..3eddeec0 100755 --- a/framework/assets/js/camera.js +++ b/framework/assets/js/camera.js @@ -95,7 +95,12 @@ Camera.prototype.getPicture = function(successCallback, errorCallback, options) */ Camera.prototype.success = function(picture) { 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) { if (this.errorCallback) { - this.errorCallback(err); + try { + this.errorCallback(err); + } + catch (e) { + console.log("Camera error calling user's error callback: " + e); + } } };