Better default error message for Shapeshift error.

This commit is contained in:
Brendon Duncan 2018-09-06 11:27:48 +12:00
commit 394317bc46
2 changed files with 8 additions and 5 deletions

View file

@ -3854,3 +3854,7 @@ msgstr ""
#: www/views/amount.html.js:60 #: www/views/amount.html.js:60
msgid "Send Maximum Amount" msgid "Send Maximum Amount"
msgstr "" msgstr ""
#: src/js/controllers/amount.controller.js:239
msgid "Unknown error."
msgstr ""

View file

@ -221,7 +221,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
} }
function initForShapeshift() { function initForShapeshift() {
console.log('initForShapeshift()');
if (vm.thirdParty.id === 'shapeshift') { if (vm.thirdParty.id === 'shapeshift') {
vm.thirdParty.data = vm.thirdParty.data || {}; vm.thirdParty.data = vm.thirdParty.data || {};
@ -234,17 +233,17 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
ongoingProcess.set('connectingShapeshift', true); ongoingProcess.set('connectingShapeshift', true);
shapeshiftService.getMarketData(vm.fromWallet.coin, vm.toWallet.coin, function onMarketData(data) { shapeshiftService.getMarketData(vm.fromWallet.coin, vm.toWallet.coin, function onMarketData(data) {
console.log('sendmax onMarketData()');
ongoingProcess.set('connectingShapeshift', false); ongoingProcess.set('connectingShapeshift', false);
if (data.error) { if (data.error) {
// TODO: translatable string. use goBack(), don't execute the code beyond. var defaultErrorMessage = gettextCatalog.getString('Unknown error.');
popupService.showAlert( popupService.showAlert(
gettextCatalog.getString('Shapeshift Error'), gettextCatalog.getString('Shapeshift Error'),
typeof data.error === 'string' ? data.error : (data.error.message ? data.error.message : ''), typeof data.error === 'string' ? data.error : (data.error.message ? data.error.message : defaultErrorMessage),
function () { function () {
goBack(); goBack();
}); }
);
} else { } else {
vm.thirdParty.data.minAmount = vm.minAmount = parseFloat(data.minimum); vm.thirdParty.data.minAmount = vm.minAmount = parseFloat(data.minimum);