aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2014-12-07 13:29:06 +0100
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2014-12-17 09:39:24 +0100
commit27df4123c433e5ad4e5592f0a8fbc40ca933865b (patch)
tree90ca518364768b73da454b6f782130e13fd48ef3 /src/qt
parent851dfc7f88d1b7c42534fffcfbdb2f1bcc473045 (diff)
make all catch() arguments const
- I saw this on http://en.cppreference.com/w/cpp/language/try_catch and thought it would be a good idea - also unify used format to better be able to search for exception uses in our codebase
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoin.cpp12
-rw-r--r--src/qt/intro.cpp4
-rw-r--r--src/qt/paymentrequestplus.cpp3
-rw-r--r--src/qt/rpcconsole.cpp6
4 files changed, 12 insertions, 13 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 123777a71b..9b02650797 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -173,7 +173,7 @@ private:
boost::thread_group threadGroup;
/// Pass fatal exception message to UI thread
- void handleRunawayException(std::exception *e);
+ void handleRunawayException(const std::exception *e);
};
/** Main Bitcoin application object */
@@ -240,7 +240,7 @@ BitcoinCore::BitcoinCore():
{
}
-void BitcoinCore::handleRunawayException(std::exception *e)
+void BitcoinCore::handleRunawayException(const std::exception *e)
{
PrintExceptionContinue(e, "Runaway exception");
emit runawayException(QString::fromStdString(strMiscWarning));
@@ -260,7 +260,7 @@ void BitcoinCore::initialize()
StartDummyRPCThread();
}
emit initializeResult(rv);
- } catch (std::exception& e) {
+ } catch (const std::exception& e) {
handleRunawayException(&e);
} catch (...) {
handleRunawayException(NULL);
@@ -277,7 +277,7 @@ void BitcoinCore::shutdown()
Shutdown();
qDebug() << __func__ << ": Shutdown finished";
emit shutdownResult(1);
- } catch (std::exception& e) {
+ } catch (const std::exception& e) {
handleRunawayException(&e);
} catch (...) {
handleRunawayException(NULL);
@@ -551,7 +551,7 @@ int main(int argc, char *argv[])
}
try {
ReadConfigFile(mapArgs, mapMultiArgs);
- } catch(std::exception &e) {
+ } catch (const std::exception& e) {
QMessageBox::critical(0, QObject::tr("Bitcoin Core"),
QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what()));
return false;
@@ -628,7 +628,7 @@ int main(int argc, char *argv[])
app.exec();
app.requestShutdown();
app.exec();
- } catch (std::exception& e) {
+ } catch (const std::exception& e) {
PrintExceptionContinue(&e, "Runaway exception");
app.handleRunawayException(QString::fromStdString(strMiscWarning));
} catch (...) {
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp
index 7618bff69d..65486a02fc 100644
--- a/src/qt/intro.cpp
+++ b/src/qt/intro.cpp
@@ -95,7 +95,7 @@ void FreespaceChecker::check()
replyMessage = tr("Path already exists, and is not a directory.");
}
}
- } catch(fs::filesystem_error &e)
+ } catch (const fs::filesystem_error&)
{
/* Parent directory does not exist or is not accessible */
replyStatus = ST_ERROR;
@@ -180,7 +180,7 @@ void Intro::pickDataDirectory()
try {
TryCreateDirectory(GUIUtil::qstringToBoostPath(dataDir));
break;
- } catch(fs::filesystem_error &e) {
+ } catch (const fs::filesystem_error&) {
QMessageBox::critical(0, tr("Bitcoin Core"),
tr("Error: Specified data directory \"%1\" cannot be created.").arg(dataDir));
/* fall through, back to choosing screen */
diff --git a/src/qt/paymentrequestplus.cpp b/src/qt/paymentrequestplus.cpp
index a40b5bbcd8..ca3f06962a 100644
--- a/src/qt/paymentrequestplus.cpp
+++ b/src/qt/paymentrequestplus.cpp
@@ -181,8 +181,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
}
// TODO: detect EV certificates and set merchant = business name instead of unfriendly NID_commonName ?
}
- catch (SSLVerifyError& err)
- {
+ catch (const SSLVerifyError& err) {
fResult = false;
qWarning() << "PaymentRequestPlus::getMerchant : SSL error: " << err.what();
}
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 2defdf8bb4..9fb15dc6fd 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -180,7 +180,7 @@ void RPCExecutor::request(const QString &command)
emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint));
}
- catch (json_spirit::Object& objError)
+ catch (const json_spirit::Object& objError)
{
try // Nice formatting for standard-format error
{
@@ -188,12 +188,12 @@ void RPCExecutor::request(const QString &command)
std::string message = find_value(objError, "message").get_str();
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(message) + " (code " + QString::number(code) + ")");
}
- catch(std::runtime_error &) // raised when converting to invalid type, i.e. missing code or message
+ catch (const std::runtime_error&) // raised when converting to invalid type, i.e. missing code or message
{ // Show raw JSON object
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), false)));
}
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
emit reply(RPCConsole::CMD_ERROR, QString("Error: ") + QString::fromStdString(e.what()));
}