Skip to content

Commit 1b8fd35

Browse files
committed
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.
1 parent afe2a20 commit 1b8fd35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/tinyformat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ namespace tinyformat {}
109109
namespace tfm = tinyformat;
110110

111111
// Error handling; calls assert() by default.
112-
// #define TINYFORMAT_ERROR(reasonString) your_error_handler(reasonString)
112+
#define TINYFORMAT_ERROR(reasonString) throw std::runtime_error(reasonString)
113113

114114
// Define for C++11 variadic templates which make the code shorter & more
115115
// general. If you don't define this, C++11 support is autodetected below.

0 commit comments

Comments
 (0)