mirror of https://github.com/BTCPrivate/copay.git
Translates errors from send
This commit is contained in:
parent
9d2a6614c8
commit
ec471bdba3
|
@ -249,7 +249,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
self.setOngoingProcess();
|
||||
if (err) {
|
||||
$scope.loading = false;
|
||||
$scope.error = bwsError.msg(err, gettext('Could not accept payment'));
|
||||
$scope.error = bwsError.msg(err, gettextCatalog.getString('Could not accept payment'));
|
||||
$scope.$digest();
|
||||
} else {
|
||||
//if txp has required signatures then broadcast it
|
||||
|
@ -261,7 +261,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
self.setOngoingProcess();
|
||||
$scope.loading = false;
|
||||
if (err) {
|
||||
$scope.error = bwsError.msg(err, gettext('Could not broadcast payment'));
|
||||
$scope.error = bwsError.msg(err, gettextCatalog.getString('Could not broadcast payment'));
|
||||
$scope.$digest();
|
||||
} else {
|
||||
$log.debug('Transaction signed and broadcasted')
|
||||
|
@ -290,7 +290,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
self.setOngoingProcess();
|
||||
$scope.loading = false;
|
||||
if (err) {
|
||||
$scope.error = bwsError.msg(err, gettext('Could not reject payment'));
|
||||
$scope.error = bwsError.msg(err, gettextCatalog.getString('Could not reject payment'));
|
||||
$scope.$digest();
|
||||
} else {
|
||||
$modalInstance.close(txpr);
|
||||
|
@ -311,7 +311,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
// Hacky: request tries to parse an empty response
|
||||
if (err && !(err.message && err.message.match(/Unexpected/))) {
|
||||
$scope.error = bwsError.msg(err, gettext('Could not delete payment proposal'));
|
||||
$scope.error = bwsError.msg(err, gettextCatalog.getString('Could not delete payment proposal'));
|
||||
$scope.$digest();
|
||||
return;
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
self.setOngoingProcess();
|
||||
$scope.loading = false;
|
||||
if (err) {
|
||||
$scope.error = bwsError.msg(err, gettext('Could not broadcast payment'));
|
||||
$scope.error = bwsError.msg(err, gettextCatalog.getString('Could not broadcast payment'));
|
||||
$scope.$digest();
|
||||
} else {
|
||||
|
||||
|
@ -657,7 +657,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
this.setSendError = function(err) {
|
||||
var fc = profileService.focusedClient;
|
||||
var prefix =
|
||||
fc.credentials.m > 1 ? gettext('Could not create payment proposal') : gettext('Could not send payment');
|
||||
fc.credentials.m > 1 ? gettextCatalog.getString('Could not create payment proposal') : gettextCatalog.getString('Could not send payment');
|
||||
|
||||
this.error = bwsError.msg(err, prefix);
|
||||
|
||||
|
@ -781,7 +781,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
profileService.lockFC();
|
||||
self.setOngoingProcess();
|
||||
if (err) {
|
||||
err.message = bwsError.msg(err, gettext('The payment was created but could not be signed. Please try again from home screen'));
|
||||
err.message = bwsError.msg(err, gettextCatalog.getString('The payment was created but could not be signed. Please try again from home screen'));
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
|
@ -790,7 +790,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
fc.broadcastTxProposal(signedTx, function(err, btx, memo) {
|
||||
self.setOngoingProcess();
|
||||
if (err) {
|
||||
err.message = bwsError.msg(err, gettext('The payment was signed but could not be broadcasted. Please try again from home screen'));
|
||||
err.message = bwsError.msg(err, gettextCatalog.getString('The payment was signed but could not be broadcasted. Please try again from home screen'));
|
||||
return cb(err);
|
||||
}
|
||||
if (memo)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.services')
|
||||
.factory('bwsError', function bwcErrorService($log, gettext) {
|
||||
.factory('bwsError', function bwcErrorService($log, gettextCatalog) {
|
||||
var root = {};
|
||||
|
||||
root.msg = function(err, prefix) {
|
||||
|
@ -10,85 +10,84 @@ angular.module('copayApp.services')
|
|||
if (err && err.code) {
|
||||
switch(err.code) {
|
||||
case 'CONNECTION_ERROR':
|
||||
body = gettext('Network connection error');
|
||||
body = gettextCatalog.getString('Network connection error');
|
||||
break;
|
||||
case 'NOT_FOUND':
|
||||
body = gettext('Wallet service not found');
|
||||
body = gettextCatalog.getString('Wallet service not found');
|
||||
break;
|
||||
case 'BAD_SIGNATURES':
|
||||
body = gettext('Signatures rejected by server');
|
||||
body = gettextCatalog.getString('Signatures rejected by server');
|
||||
break;
|
||||
case 'COPAYER_DATA_MISMATCH':
|
||||
body = gettext('Copayer data mismatch');
|
||||
body = gettextCatalog.getString('Copayer data mismatch');
|
||||
break;
|
||||
case 'COPAYER_IN_WALLET':
|
||||
body = gettext('Copayer already in this wallet');
|
||||
body = gettextCatalog.getString('Copayer already in this wallet');
|
||||
break;
|
||||
case 'COPAYER_REGISTERED':
|
||||
body = gettext('Copayer already registered');
|
||||
body = gettextCatalog.getString('Copayer already registered');
|
||||
break;
|
||||
case 'COPAYER_VOTED':
|
||||
body = gettext('Copayer already voted on this spend proposal');
|
||||
body = gettextCatalog.getString('Copayer already voted on this spend proposal');
|
||||
break;
|
||||
case 'DUST_AMOUNT':
|
||||
body = gettext('Amount below dust threshold');
|
||||
body = gettextCatalog.getString('Amount below dust threshold');
|
||||
break;
|
||||
case 'INCORRECT_ADDRESS_NETWORK':
|
||||
body = gettext('Incorrect address network');
|
||||
body = gettextCatalog.getString('Incorrect address network');
|
||||
break;
|
||||
case 'INSUFFICIENT_FUNDS':
|
||||
body = gettext('Insufficient funds');
|
||||
body = gettextCatalog.getString('Insufficient funds');
|
||||
break;
|
||||
case 'INSUFFICIENT_FUNDS_FOR_FEE':
|
||||
body = gettext('Insufficient funds for fee');
|
||||
body = gettextCatalog.getString('Insufficient funds for fee');
|
||||
break;
|
||||
case 'INVALID_ADDRESS':
|
||||
body = gettext('Invalid address');
|
||||
body = gettextCatalog.getString('Invalid address');
|
||||
break;
|
||||
case 'LOCKED_FUNDS':
|
||||
body = gettext('Funds are locked by pending spend proposals');
|
||||
body = gettextCatalog.getString('Funds are locked by pending spend proposals');
|
||||
break;
|
||||
case 'NOT_AUTHORIZED':
|
||||
body = gettext('Not authorized');
|
||||
body = gettextCatalog.getString('Not authorized');
|
||||
break;
|
||||
case 'TX_ALREADY_BROADCASTED':
|
||||
body = gettext('Transaction already broadcasted');
|
||||
body = gettextCatalog.getString('Transaction already broadcasted');
|
||||
break;
|
||||
case 'TX_CANNOT_CREATE':
|
||||
body = gettext('Locktime in effect. Please wait to create a new spend proposal');
|
||||
body = gettextCatalog.getString('Locktime in effect. Please wait to create a new spend proposal');
|
||||
break;
|
||||
case 'TX_CANNOT_REMOVE':
|
||||
body = gettext('Locktime in effect. Please wait to remove this spend proposal');
|
||||
body = gettextCatalog.getString('Locktime in effect. Please wait to remove this spend proposal');
|
||||
break;
|
||||
case 'TX_NOT_ACCEPTED':
|
||||
body = gettext('Spend proposal is not accepted');
|
||||
body = gettextCatalog.getString('Spend proposal is not accepted');
|
||||
break;
|
||||
case 'TX_NOT_FOUND':
|
||||
body = gettext('Spend proposal not found');
|
||||
body = gettextCatalog.getString('Spend proposal not found');
|
||||
break;
|
||||
case 'TX_NOT_PENDING':
|
||||
body = gettext('The spend proposal is not pending');
|
||||
body = gettextCatalog.getString('The spend proposal is not pending');
|
||||
break;
|
||||
case 'UPGRADE_NEEDED':
|
||||
body = gettext('Please upgrade Copay to perform this action');
|
||||
body = gettextCatalog.getString('Please upgrade Copay to perform this action');
|
||||
break;
|
||||
case 'WALLET_ALREADY_EXISTS':
|
||||
body = gettext('Wallet already exists');
|
||||
body = gettextCatalog.getString('Wallet already exists');
|
||||
break;
|
||||
case 'WALLET_FULL':
|
||||
body = gettext('Wallet is full');
|
||||
body = gettextCatalog.getString('Wallet is full');
|
||||
break;
|
||||
case 'WALLET_NOT_COMPLETE':
|
||||
body = gettext('Wallet is not complete');
|
||||
body = gettextCatalog.getString('Wallet is not complete');
|
||||
break;
|
||||
case 'WALLET_NOT_FOUND':
|
||||
body = gettext('Wallet not found');
|
||||
body = gettextCatalog.getString('Wallet not found');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var msg = prefix + ( body ? ': ' + body : '');
|
||||
$log.warn("BWC ERROR:" + msg);
|
||||
return msg;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue