mirror of https://github.com/BTCPrivate/copay.git
better handling clientError
This commit is contained in:
parent
9efa2dfe24
commit
6186a70a50
|
@ -40,7 +40,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-show="index.updateError">
|
<div ng-show="index.updateError && !index.notAuthorized">
|
||||||
<div class="text-center text-warning m10t">
|
<div class="text-center text-warning m10t">
|
||||||
<i class="fi-alert"></i>
|
<i class="fi-alert"></i>
|
||||||
<span translate>
|
<span translate>
|
||||||
|
|
|
@ -157,7 +157,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.setOngoingProcess('updatingTxHistory', false);
|
self.setOngoingProcess('updatingTxHistory', false);
|
||||||
if (err) {
|
if (err) {
|
||||||
$log.debug('TxHistory ERROR:', err);
|
$log.debug('TxHistory ERROR:', err);
|
||||||
$scope.$emit('Local/ClientError', err);
|
self.handleError(err);
|
||||||
self.txHistoryError = true;
|
self.txHistoryError = true;
|
||||||
} else {
|
} else {
|
||||||
$log.debug('Wallet Transaction History:', txs);
|
$log.debug('Wallet Transaction History:', txs);
|
||||||
|
@ -175,8 +175,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
$scope.$emit('Local/NotAuthorized');
|
$scope.$emit('Local/NotAuthorized');
|
||||||
} else if (err.code === 'NOTFOUND') {
|
} else if (err.code === 'NOTFOUND') {
|
||||||
$scope.$emit('Local/BWSNotFound');
|
$scope.$emit('Local/BWSNotFound');
|
||||||
} else if (err.code === 'ETIMEDOUT') {
|
|
||||||
$scope.$emit('Local/BWSTimeOut');
|
|
||||||
} else {
|
} else {
|
||||||
$scope.$emit('Local/ClientError', err);
|
$scope.$emit('Local/ClientError', err);
|
||||||
}
|
}
|
||||||
|
@ -400,6 +398,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
$rootScope.$on(eventName, function(event) {
|
$rootScope.$on(eventName, function(event) {
|
||||||
$log.debug('### Online event');
|
$log.debug('### Online event');
|
||||||
self.isOffline = false;
|
self.isOffline = false;
|
||||||
|
self.clientError = null;
|
||||||
self.updateAll();
|
self.updateAll();
|
||||||
self.updateTxHistory();
|
self.updateTxHistory();
|
||||||
});
|
});
|
||||||
|
@ -426,17 +425,14 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
$rootScope.$apply();
|
$rootScope.$apply();
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('Local/BWSTimeOut', function(event) {
|
|
||||||
self.clientError = 'Could not access to Bitcore Wallet Service: Timed out';
|
|
||||||
$rootScope.$apply();
|
|
||||||
});
|
|
||||||
|
|
||||||
$rootScope.$on('Local/ClientError', function(event, err) {
|
$rootScope.$on('Local/ClientError', function(event, err) {
|
||||||
if (err.code && err.code === 'NOTAUTHORIZED') {
|
if (err.code && err.code === 'NOTAUTHORIZED') {
|
||||||
// Show not error, just redirect to home (where the recreate option is shown)
|
// Show not error, just redirect to home (where the recreate option is shown)
|
||||||
go.walletHome();
|
go.walletHome();
|
||||||
} else if (err && err.cors == 'rejected') {
|
} else if (err && err.cors == 'rejected') {
|
||||||
$log.debug('CORS error:', err);
|
$log.debug('CORS error:', err);
|
||||||
|
} else if (err.code === 'ETIMEDOUT') {
|
||||||
|
$log.debug('Time out:', err);
|
||||||
} else {
|
} else {
|
||||||
self.clientError = err;
|
self.clientError = err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue