Skip to content

Commit

Permalink
Make tinyformat errors raise an exception instead of assert()ing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
laanwj committed Feb 28, 2014
1 parent afe2a20 commit 1b8fd35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tinyformat.h
Expand Up @@ -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.
Expand Down

0 comments on commit 1b8fd35

Please sign in to comment.