Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0415210096 for ; Thu, 1 May 2014 15:19:25 +0000 (UTC) Received: (qmail 58154 invoked by uid 500); 1 May 2014 15:19:23 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 58095 invoked by uid 500); 1 May 2014 15:19:22 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 57881 invoked by uid 99); 1 May 2014 15:19:22 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 May 2014 15:19:22 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1560488B766; Thu, 1 May 2014 15:19:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agrieve@apache.org To: commits@cordova.apache.org Date: Thu, 01 May 2014 15:19:23 -0000 Message-Id: In-Reply-To: <34ebd7c2d298459998c1b0093353ec47@git.apache.org> References: <34ebd7c2d298459998c1b0093353ec47@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] git commit: Move console.log into Notify.js. Make it stringify [Object] Move console.log into Notify.js. Make it stringify [Object] Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/69042747 Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/69042747 Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/69042747 Branch: refs/heads/master Commit: 6904274765a3b807cae2cf84ed9bb132fbf80533 Parents: 9398000 Author: Andrew Grieve Authored: Thu May 1 11:16:45 2014 -0400 Committer: Andrew Grieve Committed: Thu May 1 11:19:09 2014 -0400 ---------------------------------------------------------------------- www/cdvah/js/AddCtrl.js | 22 ++++++++-------------- www/cdvah/js/ListCtrl.js | 25 +++++++------------------ www/cdvah/js/Notify.js | 8 ++++++++ 3 files changed, 23 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/69042747/www/cdvah/js/AddCtrl.js ---------------------------------------------------------------------- diff --git a/www/cdvah/js/AddCtrl.js b/www/cdvah/js/AddCtrl.js index 9d0af8b..8a75157 100644 --- a/www/cdvah/js/AddCtrl.js +++ b/www/cdvah/js/AddCtrl.js @@ -22,9 +22,7 @@ } }); if (!$scope.appData) { - var err = 'Could not find app to edit'; - console.error(err); - notifier.error(err); + notifier.error('Could not find app to edit'); } }); } else { @@ -47,7 +45,6 @@ editingApp.url = urlCleanup($scope.appData.appUrl); var urlChanged = oldUrl != editingApp.url; var p = AppsService.editApp($scope.editing, editingApp).then(function() { - console.log('App edited'); notifier.success('App edited'); $location.path('/'); }); @@ -57,25 +54,23 @@ // If the URL changed, trigger an update. return AppsService.updateApp(editingApp); }).then(function() { - console.log('Updated app due to URL change'); notifier.success('Updated app due to URL change'); }, function(err) { - var msg = 'Failed to update app: ' + err.message; - console.error(msg); - notifier.error(msg); + notifier.error(err); }); } return p; } return AppsService.addApp($scope.appData.installerType, $scope.appData.appUrl) .then(function(handler) { - console.log('App Added'); - notifier.success('App Added'); + notifier.success('App Added. Updating...'); $location.path('/'); return AppsService.updateApp(handler); + }) + .then(function(){ + notifier.success('Updated successfully'); }, function(error) { - console.error(error); - notifier.error('Unable to add application because: ' + error.message); + notifier.error(error); }); }; @@ -96,8 +91,7 @@ } }, function(error) { - console.log('QR Error: ' + error); - notifier.error('Error retrieving QR code: ' + error); + notifier.error(error); deferred.reject(error); }); return deferred.promise; http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/69042747/www/cdvah/js/ListCtrl.js ---------------------------------------------------------------------- diff --git a/www/cdvah/js/ListCtrl.js b/www/cdvah/js/ListCtrl.js index da66390..4ed7743 100644 --- a/www/cdvah/js/ListCtrl.js +++ b/www/cdvah/js/ListCtrl.js @@ -17,8 +17,7 @@ if (action == 'restart') { return AppsService.launchApp(activeApp) .then(null, function(e){ - console.error('Error launching last run app: ' + e); - notifier.error('' + e); + notifier.error(e); }); } else if (action == 'update') { // Updating may take a while so we show the apps list like we normally do @@ -26,8 +25,7 @@ .then(function() { return AppsService.launchApp(activeApp); }).then(null, function(e){ - console.error('Error updating last run app: ' + e); - notifier.error('' + e); + notifier.error(e); }); } } @@ -65,7 +63,6 @@ promise = AppsService.addApp(obj.type, obj.url).then(function(h) { handler = h; var msg = 'Added new app ' + handler.appId + ' from push'; - console.log(msg); notifier.success(msg); }).then(function() { // Reload so the app is visible while it's updating (below). @@ -85,9 +82,7 @@ }).then(function() { return $scope.launchApp(theApp, { stopPropagation: function() { } }); }).then(null, function(err) { - var msg = 'Failed to update ' + app.appId + ': ' + err; - console.error(msg); - notifier.error(msg); + notifier.error(err); }); }); } @@ -108,9 +103,7 @@ }); $scope.appList = newAppsList; }, function(error){ - var str = 'There was an error retrieving the apps list'; - console.error(str + ': ' + error); - notifier.error('' + error); + notifier.error(error); }); }; @@ -118,8 +111,7 @@ event.stopPropagation(); return AppsService.launchApp(app) .then(null, function(error){ - console.error('Error during loading of app ' + app.appId + ': ' + error); - notifier.error('' + error); + notifier.error(error); }); }; @@ -128,10 +120,8 @@ return AppsService.updateApp(app) .then(function(){ notifier.success('Updated successfully'); - console.log('successfully updated'); }, function(error) { - console.error('Error during updating of app ' + app.appId + ': ' + error); - notifier.error('' + error); + notifier.error(error); }); }; @@ -143,8 +133,7 @@ .then(function() { return $scope.loadAppsList(); }, function(error) { - console.error(error); - notifier.error('' + error); + notifier.error(error); }); } }; http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/69042747/www/cdvah/js/Notify.js ---------------------------------------------------------------------- diff --git a/www/cdvah/js/Notify.js b/www/cdvah/js/Notify.js index e014926..5246617 100644 --- a/www/cdvah/js/Notify.js +++ b/www/cdvah/js/Notify.js @@ -23,9 +23,17 @@ myApp.factory('notifier', ['$rootScope', function($rootScope) { return { success: function(msg) { + console.log(msg); $rootScope.notification = { message: msg, type: 'success' }; }, error: function(msg) { + if (typeof(msg) == 'object') { + msg = msg.message || msg; + } + if (msg && typeof msg != 'string') { + msg = JSON.stringify(msg); + } + console.error(msg); $rootScope.notification = { message: msg, type: 'error' }; } };