handling new errors

This commit is contained in:
Javier 2016-01-22 18:16:50 -03:00
commit 3e1c91f19d
5 changed files with 23 additions and 20 deletions

View file

@ -1,8 +1,9 @@
'use strict';
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, pushNotificationsService, lodash, go, profileService, configService, isCordova, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, nodeWebkit, addonManager, feeService, isChromeApp, bwsError, txFormatService, uxLanguage, $state, glideraService, isMobile, addressbookService) {
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, bwcService, pushNotificationsService, lodash, go, profileService, configService, isCordova, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, nodeWebkit, addonManager, feeService, isChromeApp, bwsError, txFormatService, uxLanguage, $state, glideraService, isMobile, addressbookService) {
var self = this;
var SOFT_CONFIRMATION_LIMIT = 12;
var errors = bwcService.getErrors();
self.isCordova = isCordova;
self.isChromeApp = isChromeApp;
self.isSafari = isMobile.Safari();
@ -470,10 +471,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
// Debounce function avoids multiple popups
var _handleError = function(err) {
$log.warn('Client ERROR: ', err);
if (err.code === 'NOT_AUTHORIZED') {
if (err instanceof errors.NOT_AUTHORIZED) {
self.notAuthorized = true;
go.walletHome();
} else if (err.code === 'NOT_FOUND') {
} else if (err instanceof errors.NOT_FOUND) {
self.showErrorPopup(gettext('Could not access Wallet Service: Not found'));
} else {
var msg = ""

View file

@ -286,8 +286,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$rootScope.$on(eventName, function() {
fc.getTx($scope.tx.id, function(err, tx) {
if (err) {
if (err.code && err.code == 'TX_NOT_FOUND' &&
if (err.message && err.message == 'TX_NOT_FOUND' &&
(eventName == 'transactionProposalRemoved' || eventName == 'TxProposalRemoved')) {
$scope.tx.removed = true;
$scope.tx.canBeRemoved = false;
@ -1100,15 +1099,15 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$scope.settings = walletSettings;
$scope.color = fc.backgroundColor;
$scope.copayerId = fc.credentials.copayerId;
$scope.isShared = fc.credentials.n > 1;
$scope.isShared = fc.credentials.n > 1;
$scope.getAlternativeAmount = function() {
var satToBtc = 1 / 100000000;
fc.getFiatRate({
code : self.alternativeIsoCode,
ts : btx.time * 1000
fc.getFiatRate({
code: self.alternativeIsoCode,
ts: btx.time * 1000
}, function(err, res) {
if (err) {
if (err) {
$log.debug('Could not get historic rate');
return;
}