Merge #16095: Catch by reference not value in wallettool

ae7faf20d5 Exceptions should be caught by reference, not by value. (Kristaps Kaupe)

Pull request description:

  Fixes this warning with GCC8/GCC9:
  ```
  wallet/wallettool.cpp: In function ‘std::shared_ptr<CWallet> WalletTool::LoadWallet(const string&, const boost::filesystem::path&)’:
  wallet/wallettool.cpp:62:25: warning: catching polymorphic type ‘const class std::runtime_error’ by value [-Wcatch-value=]
       } catch (const std::runtime_error) {
                           ^~~~~~~~~~~~~
  ```
  Related to #15822.

ACKs for commit ae7faf:
  practicalswift:
    utACK ae7faf20d5

Tree-SHA512: 07eb774b3296c0b66ac5040269bff6cd8ba0294c8c95cc08c595efbd535260ff0010fa430ca057eeccd7b38c0a981a3d7a95b675d9e2996853c013dc0bfe8127
This commit is contained in:
MarcoFalke 2019-05-27 09:01:44 -04:00
commit 76e2cded47
No known key found for this signature in database
GPG key ID: D2EA4850E7528B25

View file

@ -59,7 +59,7 @@ static std::shared_ptr<CWallet> LoadWallet(const std::string& name, const fs::pa
try { try {
bool first_run; bool first_run;
load_wallet_ret = wallet_instance->LoadWallet(first_run); load_wallet_ret = wallet_instance->LoadWallet(first_run);
} catch (const std::runtime_error) { } catch (const std::runtime_error&) {
fprintf(stderr, "Error loading %s. Is wallet being used by another process?\n", name.c_str()); fprintf(stderr, "Error loading %s. Is wallet being used by another process?\n", name.c_str());
return nullptr; return nullptr;
} }