aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-06-06 09:48:37 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-06-06 09:49:47 +0000
commitc820e1839f762290c4c6488dff0c66f609adab1d (patch)
tree47f5ac7def8c4ed0138ef87e058792e24bc090d5 /src/simplewallet/simplewallet.cpp
parentMerge pull request #5583 (diff)
downloadmonero-c820e1839f762290c4c6488dff0c66f609adab1d.tar.xz
simplewallet: print errors on exceptions creating wallets
Exceptions would otherwise terminate the process silently
Diffstat (limited to '')
-rw-r--r--src/simplewallet/simplewallet.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 02a099811..30f82cad0 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -4237,7 +4237,9 @@ boost::optional<tools::password_container> simple_wallet::get_and_verify_passwor
boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::program_options::variables_map& vm,
const crypto::secret_key& recovery_key, bool recover, bool two_random, const std::string &old_language)
{
- auto rc = tools::wallet2::make_new(vm, false, password_prompter);
+ std::pair<std::unique_ptr<tools::wallet2>, tools::password_container> rc;
+ try { rc = tools::wallet2::make_new(vm, false, password_prompter); }
+ catch(const std::exception &e) { fail_msg_writer() << tr("Error creating wallet: ") << e.what(); return {}; }
m_wallet = std::move(rc.first);
if (!m_wallet)
{
@@ -4332,7 +4334,9 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
const cryptonote::account_public_address& address, const boost::optional<crypto::secret_key>& spendkey,
const crypto::secret_key& viewkey)
{
- auto rc = tools::wallet2::make_new(vm, false, password_prompter);
+ std::pair<std::unique_ptr<tools::wallet2>, tools::password_container> rc;
+ try { rc = tools::wallet2::make_new(vm, false, password_prompter); }
+ catch(const std::exception &e) { fail_msg_writer() << tr("Error creating wallet: ") << e.what(); return {}; }
m_wallet = std::move(rc.first);
if (!m_wallet)
{
@@ -4378,7 +4382,9 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
//----------------------------------------------------------------------------------------------------
boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::program_options::variables_map& vm)
{
- auto rc = tools::wallet2::make_new(vm, false, password_prompter);
+ std::pair<std::unique_ptr<tools::wallet2>, tools::password_container> rc;
+ try { rc = tools::wallet2::make_new(vm, false, password_prompter); }
+ catch(const std::exception &e) { fail_msg_writer() << tr("Error creating wallet: ") << e.what(); return {}; }
m_wallet = std::move(rc.first);
m_wallet->callback(this);
if (!m_wallet)
@@ -4419,7 +4425,9 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::program_options::variables_map& vm,
const epee::wipeable_string &multisig_keys, const std::string &old_language)
{
- auto rc = tools::wallet2::make_new(vm, false, password_prompter);
+ std::pair<std::unique_ptr<tools::wallet2>, tools::password_container> rc;
+ try { rc = tools::wallet2::make_new(vm, false, password_prompter); }
+ catch(const std::exception &e) { fail_msg_writer() << tr("Error creating wallet: ") << e.what(); return {}; }
m_wallet = std::move(rc.first);
if (!m_wallet)
{