handle errors
This commit is contained in:
parent
e16e93e408
commit
ee99c03602
1 changed files with 3 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
angular.module('copayApp.controllers').controller('paperWalletController',
|
angular.module('copayApp.controllers').controller('paperWalletController',
|
||||||
function($scope, $timeout, $log, $ionicModal, $ionicHistory, platformInfo, configService, profileService, $state, addressService, bitcore, ongoingProcess, txFormatService, $stateParams, walletService) {
|
function($scope, $timeout, $log, $ionicModal, $ionicHistory, popupService, gettextCatalog, platformInfo, configService, profileService, $state, addressService, bitcore, ongoingProcess, txFormatService, $stateParams, walletService) {
|
||||||
var wallet = profileService.getWallet($stateParams.walletId);
|
var wallet = profileService.getWallet($stateParams.walletId);
|
||||||
var rawTx;
|
var rawTx;
|
||||||
|
|
||||||
|
|
@ -26,7 +26,6 @@ angular.module('copayApp.controllers').controller('paperWalletController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.onData = function(data) {
|
$scope.onData = function(data) {
|
||||||
$scope.error = null;
|
|
||||||
$scope.scannedKey = data;
|
$scope.scannedKey = data;
|
||||||
$scope.isPkEncrypted = (data.substring(0, 2) == '6P');
|
$scope.isPkEncrypted = (data.substring(0, 2) == '6P');
|
||||||
};
|
};
|
||||||
|
|
@ -64,7 +63,6 @@ angular.module('copayApp.controllers').controller('paperWalletController',
|
||||||
$scope.scanFunds = function() {
|
$scope.scanFunds = function() {
|
||||||
$scope.privateKey = '';
|
$scope.privateKey = '';
|
||||||
$scope.balanceSat = 0;
|
$scope.balanceSat = 0;
|
||||||
$scope.error = null;
|
|
||||||
|
|
||||||
ongoingProcess.set('scanning', true);
|
ongoingProcess.set('scanning', true);
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
|
|
@ -72,7 +70,7 @@ angular.module('copayApp.controllers').controller('paperWalletController',
|
||||||
ongoingProcess.set('scanning', false);
|
ongoingProcess.set('scanning', false);
|
||||||
if (err) {
|
if (err) {
|
||||||
$log.error(err);
|
$log.error(err);
|
||||||
$scope.error = err.message || err.toString();
|
popupService.showAlert(gettextCatalog.getString('Error scanning funds:'), err || err.toString());
|
||||||
} else {
|
} else {
|
||||||
$scope.privateKey = privateKey;
|
$scope.privateKey = privateKey;
|
||||||
$scope.balanceSat = balance;
|
$scope.balanceSat = balance;
|
||||||
|
|
@ -107,15 +105,14 @@ angular.module('copayApp.controllers').controller('paperWalletController',
|
||||||
$scope.sweepWallet = function() {
|
$scope.sweepWallet = function() {
|
||||||
ongoingProcess.set('sweepingWallet', true);
|
ongoingProcess.set('sweepingWallet', true);
|
||||||
$scope.sending = true;
|
$scope.sending = true;
|
||||||
$scope.error = null;
|
|
||||||
|
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
_sweepWallet(function(err, destinationAddress, txid) {
|
_sweepWallet(function(err, destinationAddress, txid) {
|
||||||
ongoingProcess.set('sweepingWallet', false);
|
ongoingProcess.set('sweepingWallet', false);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
$scope.error = err.message || err.toString();
|
|
||||||
$log.error(err);
|
$log.error(err);
|
||||||
|
popupService.showAlert(gettextCatalog.getString('Error sweeping wallet:'), err || err.toString());
|
||||||
} else {
|
} else {
|
||||||
var type = walletService.getViewStatus(wallet, txp);
|
var type = walletService.getViewStatus(wallet, txp);
|
||||||
$scope.openStatusModal(type, txp, function() {
|
$scope.openStatusModal(type, txp, function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue