Improve error handler

This commit is contained in:
Gustavo Maximiliano Cortez 2015-09-08 13:58:24 -03:00
parent 07bf7b8f97
commit 82f356a513
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
4 changed files with 29 additions and 24 deletions

View File

@ -48,23 +48,26 @@
at ${{buy.buyPrice.price}} {{buy.buyPrice.currency}}
</div>
<input class="button dark-gray outline round expand"
<input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Continue'|translate}}" ng-disabled="!buy.buyPrice.qty || buy.loading">
</div>
</form>
</div>
<div ng-show="buy.show2faCodeInput && !buy.success">
<p class="text-center text-gray" translate>
The purchase price of ${{buy.buyPrice.price}} {{buy.buyPrice.currency}} will be immediately withdrawn from your bank account.
<p class="text-gray" translate>
${{buy.buyPrice.price}} {{buy.buyPrice.currency}} will be immediately withdrawn from your
bank account. The total of {{buy.buyPrice.qty}} BTC will be purchased and deposited in your bitcoin wallet ({{index.walletName}}) in 2-4 business days.
</p>
<p class="text-center text-gray" translate>
The total of {{buy.buyPrice.qty}} BTC will be purchased and deposited in your bitcoin wallet ({{index.walletName}}) in 2-4 business days.
<p class="text-gray" translate>
A SMS containing a confirmation code was sent to your phone. Please, enter code below
</p>
<form name="buyForm"
ng-submit="buy.sendRequest(index.glideraToken, index.glideraPermissions, twoFaCode)" novalidate>
<label translate>Enter 2FA Code</label>
<label translate>Glidera 2FA Code</label>
<input type="number" ng-model="twoFaCode" required>
<input class="button dark-gray outline round expand"
<input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Buy'|translate}}" ng-disabled="buyForm.$invalid || buy.loading">
</form>
</div>

View File

@ -49,23 +49,25 @@
at ${{sell.sellPrice.price}} {{sell.sellPrice.currency}}
</div>
<input class="button dark-gray outline round expand"
<input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Continue'|translate}}" ng-disabled="!sell.sellPrice.qty || sell.loading">
</div>
</form>
</div>
<div ng-show="sell.show2faCodeInput && !sell.success">
<p class="text-center text-gray" translate>
The bitcoin amount of {{sell.sellPrice.qty}} will be immediately sent from your bitcoin wallet ({{index.walletName}}) to Glidera.
<p class="text-gray" translate>
{{sell.sellPrice.qty}} BTC will be immediately sent from your wallet to Glidera. The total of ${{sell.sellPrice.subtotal}} {{sell.sellPrice.currency}} will be deposited in your bank account in 4-6 business days.
</p>
<p class="text-center text-gray" translate>
The total of ${{sell.sellPrice.subtotal}} {{sell.sellPrice.currency}} will be deposited in your bank account in 4-6 business days.
<p class="text-gray" translate>
A SMS containing a confirmation code was sent to your phone. Please, enter code below
</p>
<form name="sellForm"
ng-submit="sell.createTx(index.glideraToken, index.glideraPermissions, twoFaCode)" novalidate>
<label translate>Enter 2FA Code</label>
<label translate>Glidera 2FA Code</label>
<input type="number" ng-model="twoFaCode" required>
<input class="button dark-gray outline round expand"
<input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Sell'|translate}}" ng-disabled="sellForm.$invalid || sell.loading">
</form>
</div>

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('buyGlideraController',
function($scope, $timeout, profileService, addressService, glideraService, gettext) {
function($scope, $timeout, profileService, addressService, glideraService, gettext, gettextCatalog, bwsError) {
this.addr = {};
this.show2faCodeInput = null;
@ -17,7 +17,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
}
glideraService.buyPrice(token, price, function(err, buyPrice) {
if (err) {
self.error = gettext('Glidera could not get pricing to buy bitcoin');
self.error = gettext('Could not get exchange information. Please, try again.');
}
else {
self.buyPrice = buyPrice;
@ -32,7 +32,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
glideraService.get2faCode(token, function(err, sent) {
self.loading = null;
if (err) {
self.error = gettext('Glidera could not send the 2FA code to your phone');
self.error = gettext('Could not send confirmation code to your phone');
}
else {
self.error = null;
@ -49,7 +49,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
self.error = null;
addressService.getAddress(fc.credentials.walletId, null, function(err, addr) {
if (!addr) {
self.error = gettext('Could not get the bitcoin address');
self.error = bwsError.msg(err);
$scope.$apply();
}
else {

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('sellGlideraController',
function($scope, $timeout, $log, gettext, configService, profileService, addressService, feeService, glideraService) {
function($scope, $timeout, $log, gettext, gettextCatalog, configService, profileService, addressService, feeService, glideraService, bwsError) {
var config = configService.getSync();
this.data = {};
@ -21,7 +21,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
}
glideraService.sellPrice(token, price, function(err, sellPrice) {
if (err) {
self.error = gettext('Glidera could not get pricing to sell bitcoin');
self.error = gettext('Could not get exchange information. Please, try again.');
}
else {
self.error = null;
@ -37,7 +37,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
glideraService.get2faCode(token, function(err, sent) {
self.loading = null;
if (err) {
self.error = gettext('Glidera could not send the 2FA code to your phone');
self.error = gettext('Could not send confirmation code to your phone');
}
else {
self.show2faCodeInput = sent;
@ -56,7 +56,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
addressService.getAddress(fc.credentials.walletId, null, function(err, refundAddress) {
if (!refundAddress) {
self.loading = null;
self.error = gettext('Could not get the bitcoin address');
self.error = bwsError.msg(err);
return;
}
glideraService.getSellAddress(token, function(error, sellAddress) {
@ -83,7 +83,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
$log.error(err);
$timeout(function() {
self.loading = null;
self.error = gettext('Could not create transaction');
self.error = bwsError.msg(err, gettextCatalog.getString('Error'));
}, 1);
return;
}
@ -141,7 +141,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
fc.signTxProposal(txp, function(err, signedTx) {
profileService.lockFC();
if (err) {
err = gettext('The payment was created but could not be signed');
err = bwsError.msg(err, gettextCatalog.getString('Could not accept payment'));
return cb(err);
}
else {