From 1b4e36416ae67d3a3789333ff965866ae45bb98b Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 23 Aug 2023 15:26:36 -0400 Subject: [PATCH] make exception API more consistent blt_throw no longer halts execution BLT_THROW has been added which throws the exception --- include/blt/std/assert.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/blt/std/assert.h b/include/blt/std/assert.h index e9f8960..49cea36 100644 --- a/include/blt/std/assert.h +++ b/include/blt/std/assert.h @@ -38,7 +38,10 @@ namespace blt #define blt_assert(expr) static_cast(expr) ? void(0) : blt::b_assert_failed(#expr, __FILE__, __LINE__) // prints error with stack trace then exits with failure. #define BLT_ASSERT(expr) {static_cast(expr) ? void(0) : blt::b_assert_failed(#expr, __FILE__, __LINE__); std::exit(EXIT_FAILURE); } -#define blt_throw(throwable) {blt::b_throw(throwable.what(), __FILE__, __LINE__); throw throwable;} +// prints as error but does not throw the exception. +#define blt_throw(throwable) {blt::b_throw(throwable.what(), __FILE__, __LINE__);} +// prints as error with stack trace and throws the exception. +#define BLT_THROW(throwable) {blt::b_throw(throwable.what(), __FILE__, __LINE__); throw throwable;} #endif //BLT_ASSERT_H