aboutsummaryrefslogtreecommitdiff
path: root/src/tinyformat.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-03-13 06:51:15 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-03-13 06:51:15 +0100
commitb651270cd6bfdd6d7c4acf04d1a00c03bf09f03a (patch)
tree0626a6723ad2edb7a281990d8c5c8b148b83e8ef /src/tinyformat.h
parent3b092bd9b6b3953d5c3052d57e4827dbd85941fd (diff)
downloadbitcoin-b651270cd6bfdd6d7c4acf04d1a00c03bf09f03a.tar.xz
util: Throw tinyformat::format_error on formatting error
Throw tinyformat::format_error on formatting error instead of the `std::runtime_error`.
Diffstat (limited to 'src/tinyformat.h')
-rw-r--r--src/tinyformat.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tinyformat.h b/src/tinyformat.h
index 17f0360c42..5022d46809 100644
--- a/src/tinyformat.h
+++ b/src/tinyformat.h
@@ -123,7 +123,7 @@ namespace tinyformat {}
namespace tfm = tinyformat;
// Error handling; calls assert() by default.
-#define TINYFORMAT_ERROR(reasonString) throw std::runtime_error(reasonString)
+#define TINYFORMAT_ERROR(reasonString) throw tinyformat::format_error(reasonString)
// Define for C++11 variadic templates which make the code shorter & more
// general. If you don't define this, C++11 support is autodetected below.
@@ -164,6 +164,13 @@ namespace tfm = tinyformat;
namespace tinyformat {
+class format_error: public std::runtime_error
+{
+public:
+ format_error(const std::string &what): std::runtime_error(what) {
+ }
+};
+
//------------------------------------------------------------------------------
namespace detail {