util: Throw tinyformat::format_error on formatting error

Throw tinyformat::format_error on formatting error instead of the
`std::runtime_error`.
This commit is contained in:
Wladimir J. van der Laan
2017-03-13 06:51:15 +01:00
parent 3b092bd9b6
commit b651270cd6
2 changed files with 9 additions and 2 deletions

View File

@@ -80,7 +80,7 @@ template<typename... Args> std::string FormatStringFromLogArgs(const char *fmt,
std::string _log_msg_; /* Unlikely name to avoid shadowing variables */ \
try { \
_log_msg_ = tfm::format(__VA_ARGS__); \
} catch (std::runtime_error &e) { \
} catch (tinyformat::format_error &e) { \
/* Original format string will have newline so don't add one here */ \
_log_msg_ = "Error \"" + std::string(e.what()) + "\" while formatting log message: " + FormatStringFromLogArgs(__VA_ARGS__); \
} \