better error message
This commit is contained in:
parent
2302b63e0d
commit
64d099d15c
3 changed files with 47 additions and 18 deletions
|
|
@ -33,19 +33,29 @@
|
|||
</div>
|
||||
|
||||
<div ng-show="type == '12' ">
|
||||
<div class="box-notification m20b" ng-show="import.error">
|
||||
<div ng-show="import.importErr" class="text-warning">
|
||||
<div >
|
||||
</div>
|
||||
|
||||
<div class="m10 text-bold" translate>Could not access the wallet at the server. Please check:</div>
|
||||
<div class="p25l" translate> The password of the recovery phrase (if set) </div>
|
||||
<div class="p25l" translate> The derivation path</div>
|
||||
<div class="p25l" translate> The wallet service URL </div>
|
||||
<div class="p25l" translate> NOTE: To import a wallet from a 3rd party software, please go to Add Wallet > Create Wallet, and specify the seed there.</div>
|
||||
<div class="text-right"> <span translate>Error</span>: {{import.error|translate}}</div>
|
||||
<div class="box-notification m20b" ng-show="import.importErr">
|
||||
<div ng-show="import.importErr" class="text-warning">
|
||||
<div class="m10 text-bold" translate>Could not access the wallet at the server. Please check:</div>
|
||||
<ul class="size-12">
|
||||
<li translate>The password of the recovery phrase (if set)
|
||||
</li>
|
||||
<li translate>The derivation path
|
||||
</li>
|
||||
<li translate>The wallet service URL
|
||||
</ul>
|
||||
<div class="m15l">
|
||||
<span translate>NOTE: To import a wallet from a 3rd party software, please go to Add Wallet > Create Wallet, and specify the seed there.</span><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-notification m20b" ng-show="import.error">
|
||||
<div class="text-warning">
|
||||
{{import.error|translate}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row large-12 columns">
|
||||
<form name="importForm12" ng-submit="import.importMnemonic(importForm12)" novalidate>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('importController',
|
||||
function($scope, $rootScope, $ionicScrollDelegate, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, derivationPathHelper, platformInfo) {
|
||||
function($scope, $rootScope, $ionicScrollDelegate, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, derivationPathHelper, platformInfo, bwsError, bwcService) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
|
|
@ -9,6 +9,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
var self = this;
|
||||
var reader = new FileReader();
|
||||
var defaults = configService.getDefaults();
|
||||
var errors = bwcService.getErrors();
|
||||
$scope.bwsurl = defaults.bws.url;
|
||||
$scope.derivationPath = derivationPathHelper.default;
|
||||
$scope.account = 1;
|
||||
|
|
@ -93,14 +94,17 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
profileService.importExtendedPrivateKey(xPrivKey, opts, function(err, walletId) {
|
||||
self.loading = false;
|
||||
if (err) {
|
||||
self.error = err;
|
||||
self.importErr = true;
|
||||
|
||||
if (err instanceof errors.NOT_AUTHORIZED) {
|
||||
self.importErr = true;
|
||||
} else {
|
||||
self.error = err;
|
||||
}
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
return $timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
go.walletHome();
|
||||
|
|
@ -114,15 +118,22 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$timeout(function() {
|
||||
profileService.importMnemonic(words, opts, function(err, walletId) {
|
||||
self.loading = false;
|
||||
if (err) {
|
||||
self.error = err;
|
||||
self.importErr = true;
|
||||
|
||||
if (err) {
|
||||
console.log('[import.js.122:err:]',err); //TODO
|
||||
if (err instanceof errors.NOT_AUTHORIZED) {
|
||||
|
||||
console.log('[import.js.125]'); //TODO
|
||||
self.importErr = true;
|
||||
} else {
|
||||
self.error = err;
|
||||
}
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
return $timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
go.walletHome();
|
||||
|
|
|
|||
|
|
@ -543,8 +543,12 @@ angular.module('copayApp.services')
|
|||
$log.debug('Importing Wallet xPrivKey');
|
||||
|
||||
walletClient.importFromExtendedPrivateKey(xPrivKey, opts, function(err) {
|
||||
if (err)
|
||||
if (err) {
|
||||
if (err instanceof errors.NOT_AUTHORIZED)
|
||||
return cb(err);
|
||||
|
||||
return bwsError.cb(err, gettext('Could not import'), cb);
|
||||
}
|
||||
|
||||
root.addAndBindWalletClient(walletClient, {
|
||||
bwsurl: opts.bwsurl,
|
||||
|
|
@ -571,8 +575,12 @@ angular.module('copayApp.services')
|
|||
passphrase: opts.passphrase,
|
||||
account: opts.account || 0,
|
||||
}, function(err) {
|
||||
if (err)
|
||||
if (err) {
|
||||
if (err instanceof errors.NOT_AUTHORIZED)
|
||||
return cb(err);
|
||||
|
||||
return bwsError.cb(err, gettext('Could not import'), cb);
|
||||
}
|
||||
|
||||
root.addAndBindWalletClient(walletClient, {
|
||||
bwsurl: opts.bwsurl,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue