fix displaying errors
This commit is contained in:
parent
f22860a7a0
commit
d6c25896f7
1 changed files with 42 additions and 29 deletions
|
|
@ -25,53 +25,66 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
||||||
|
|
||||||
$scope.sign = function(txp) {
|
$scope.sign = function(txp) {
|
||||||
$scope.error = null;
|
$scope.error = null;
|
||||||
|
var prefix = fc.credentials.m > 1 ? gettextCatalog.getString('Could not create payment proposal') : gettextCatalog.getString('Could not send payment');
|
||||||
|
|
||||||
$scope.loading = 'Signing Transaction';
|
$scope.loading = 'Signing Transaction';
|
||||||
|
fingerprintService.check(fc, function(err) {
|
||||||
|
if (err) {
|
||||||
|
$scope.loading = null;
|
||||||
|
$scope.error = prefix;
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$digest();
|
||||||
|
}, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$timeout(function() {
|
handleEncryptedWallet(function(err) {
|
||||||
|
|
||||||
fingerprintService.check(fc, function(err) {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
$scope.error = bwcError.msg(err);
|
|
||||||
$scope.loading = null;
|
$scope.loading = null;
|
||||||
|
$scope.error = bwcError.msg(err, prefix);
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$digest();
|
||||||
|
}, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleEncryptedWallet(function(err) {
|
walletService.signTx(fc, txp, function(err, signedTxp) {
|
||||||
if (err) {
|
if (err) {
|
||||||
$scope.error = bwcError.msg(err);
|
|
||||||
$scope.loading = null;
|
$scope.loading = null;
|
||||||
|
$scope.error = bwcError.msg(err, prefix);
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$digest();
|
||||||
|
}, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
walletService.signTx(fc, txp, function(err, signedTxp) {
|
if (signedTxp.status == 'accepted') {
|
||||||
walletService.lock(fc);
|
$scope.loading = 'Broadcasting Transaction';
|
||||||
if (err) {
|
walletService.broadcastTx(fc, signedTxp, function(err, broadcastedTxp) {
|
||||||
$scope.error = bwcError.msg(err);
|
|
||||||
$scope.loading = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (signedTxp.status == 'accepted') {
|
|
||||||
$scope.loading = 'Broadcasting Transaction';
|
|
||||||
walletService.broadcastTx(fc, signedTxp, function(err, broadcastedTxp) {
|
|
||||||
$scope.loading = null;
|
|
||||||
$scope.$emit('UpdateTx');
|
|
||||||
$scope.close(broadcastedTxp);
|
|
||||||
if (err) {
|
|
||||||
$scope.error = err;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$scope.loading = null;
|
$scope.loading = null;
|
||||||
$scope.$emit('UpdateTx');
|
$scope.$emit('UpdateTx');
|
||||||
$scope.close(signedTxp);
|
$scope.close(broadcastedTxp);
|
||||||
}
|
if (err) {
|
||||||
});
|
$scope.error = err;
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$digest();
|
||||||
|
}, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$scope.loading = null;
|
||||||
|
$scope.$emit('UpdateTx');
|
||||||
|
$scope.close(signedTxp);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, 10);
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.$on('$destroy', function() {
|
||||||
|
walletService.lock(fc);
|
||||||
|
});
|
||||||
|
|
||||||
$scope.reject = function(txp) {
|
$scope.reject = function(txp) {
|
||||||
$scope.loading = 'Rejecting payment';
|
$scope.loading = 'Rejecting payment';
|
||||||
$scope.error = null;
|
$scope.error = null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue