error notifications

This commit is contained in:
Matias Alejo Garcia 2015-04-23 18:28:21 -03:00
commit 30eb9bf0c5
6 changed files with 22 additions and 28 deletions

View file

@ -72,7 +72,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.alternativeBalanceAvailable = false;
self.totalBalanceAlternative = null;
self.notAuthorized = false;
self.clientError = null;
self.txHistory = [];
self.txHistoryPaging = false;
@ -411,17 +410,27 @@ angular.module('copayApp.controllers').controller('indexController', function($r
};
self.clientError = function (err) {
if (isCordova) {
navigator.notification.confirm(
err,
function() {},
'Wallet Server Error', ['OK']
);
} else {
alert(err);
}
};
self.recreate = function(cb) {
var fc = profileService.focusedClient;
self.setOngoingProcess('recreating', true);
self.clientError = null;
fc.recreateWallet(function(err) {
self.notAuthorized = false;
self.setOngoingProcess('recreating', false);
if (err) {
self.clientError = 'Could not recreate wallet:' + err;
self.clientError('Could not recreate wallet:' + err);
$rootScope.$apply();
return;
}
@ -458,7 +467,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (err) {
if (self.walletId == walletId)
self.setOngoingProcess('scanning', false);
self.clientError = 'Could not scan wallet:' + err;
self.clientError = ('Could not scan wallet:' + err);
$rootScope.$apply();
}
});
@ -522,7 +531,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$rootScope.$on(eventName, function(event) {
$log.debug('### Online event');
self.isOffline = false;
self.clientError = null;
self.updateAll();
self.updateTxHistory();
});
@ -544,7 +552,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
$rootScope.$on('Local/BWSNotFound', function(event) {
self.clientError = 'Could not access to Bitcore Wallet Service: Service not found';
self.clientError('Could not access to Bitcore Wallet Service: Service not found');
$rootScope.$apply();
});
@ -557,7 +565,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
} else if (err.code === 'ETIMEDOUT') {
$log.debug('Time out:', err);
} else {
self.clientError = err;
self.clientError(err && err.message ? 'Error at Bitcore Wallet Service:' + err.message : err);
}
$rootScope.$apply();
});
@ -627,7 +635,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$timeout(function() {
self.hasProfile = true;
self.noFocusedWallet = true;
self.clientError = null;
self.isComplete = null;
self.walletName = null;
go.addWallet();