From 1b8fd35aadfad6a1e55391f02add6076c8c9ea8f Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 28 Feb 2014 09:25:00 +0100 Subject: [PATCH] Make tinyformat errors raise an exception instead of assert()ing By default tinyformat errors such as 'wrong number of conversion specifiers in format string' cause an assertion failure. Raise an exception instead so that error handling can recover or can show an appropriate error. --- src/tinyformat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tinyformat.h b/src/tinyformat.h index 04b51f0adcd..b6113029f59 100644 --- a/src/tinyformat.h +++ b/src/tinyformat.h @@ -109,7 +109,7 @@ namespace tinyformat {} namespace tfm = tinyformat; // Error handling; calls assert() by default. -// #define TINYFORMAT_ERROR(reasonString) your_error_handler(reasonString) +#define TINYFORMAT_ERROR(reasonString) throw std::runtime_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.