From 579aea2ddcf93057501aba2516241cdf4ffa88d5 Mon Sep 17 00:00:00 2001 From: Abhiram Hatolkar Date: Tue, 10 Apr 2018 18:50:18 +0530 Subject: [PATCH] https://github.com/ConsenSys/eth-lightwallet/issues/182: createVault function will now send error in callback if invalid mnemonic occurs --- lib/keystore.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/keystore.js b/lib/keystore.js index 4dd02db7..d9d1b657 100644 --- a/lib/keystore.js +++ b/lib/keystore.js @@ -111,9 +111,12 @@ KeyStore.createVault = function(opts, cb) { if (err) return cb(err); var ks = new KeyStore(); - ks.init(opts.seedPhrase, pwDerivedKey, opts.hdPathString, opts.salt); - - cb(null, ks); + try{ + ks.init(opts.seedPhrase, pwDerivedKey, opts.hdPathString, opts.salt); + cb(null, ks); + } catch(err) { + cb(err, null); + } }); };