aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
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/util.cpp
parent851dfc7f88d1b7c42534fffcfbdb2f1bcc473045 (diff)
downloadbitcoin-27df4123c433e5ad4e5592f0a8fbc40ca933865b.tar.xz
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/util.cpp')
-rw-r--r--src/util.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 0cdf4e614d..282e54e488 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -346,7 +346,7 @@ bool SoftSetBoolArg(const std::string& strArg, bool fValue)
return SoftSetArg(strArg, std::string("0"));
}
-static std::string FormatException(std::exception* pex, const char* pszThread)
+static std::string FormatException(const std::exception* pex, const char* pszThread)
{
#ifdef WIN32
char pszModule[MAX_PATH] = "";
@@ -362,7 +362,7 @@ static std::string FormatException(std::exception* pex, const char* pszThread)
"UNKNOWN EXCEPTION \n%s in %s \n", pszModule, pszThread);
}
-void PrintExceptionContinue(std::exception* pex, const char* pszThread)
+void PrintExceptionContinue(const std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
LogPrintf("\n\n************************\n%s\n", message);
@@ -514,7 +514,7 @@ bool TryCreateDirectory(const boost::filesystem::path& p)
try
{
return boost::filesystem::create_directory(p);
- } catch (boost::filesystem::filesystem_error) {
+ } catch (const boost::filesystem::filesystem_error&) {
if (!boost::filesystem::exists(p) || !boost::filesystem::is_directory(p))
throw;
}
@@ -721,8 +721,7 @@ void SetupEnvironment()
#else // boost filesystem v2
std::locale(); // Raises runtime error if current locale is invalid
#endif
- } catch(std::runtime_error &e)
- {
+ } catch (const std::runtime_error&) {
setenv("LC_ALL", "C", 1); // Force C locale
}
#endif