Merge pull request #548 from cmgustavo/bug/import-backup

Handle error when importing a backup
This commit is contained in:
Mario Colque 2014-06-04 16:52:31 -03:00
commit 29c8d0ba00
1 changed files with 7 additions and 2 deletions

View File

@ -6,10 +6,15 @@ angular.module('copayApp.controllers').controller('ImportController',
var reader = new FileReader();
var _importBackup = function(encryptedObj) {
Passphrase.getBase64Async($scope.password, function(passphrase){
var w = walletFactory.fromEncryptedObj(encryptedObj, passphrase);
var w, errMsg;
try {
w = walletFactory.fromEncryptedObj(encryptedObj, passphrase);
} catch(e) {
errMsg = e.message;
}
if (!w) {
$scope.loading = false;
$rootScope.$flashMessage = { message: 'Wrong password', type: 'error'};
$rootScope.$flashMessage = { message: errMsg || 'Wrong password', type: 'error'};
$rootScope.$digest();
return;
}