From 7a551435a01d76903937f15723473b06d67c5220 Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 2 Aug 2024 23:30:17 -0400 Subject: [PATCH] doctor give me exceptions --- CMakeLists.txt | 2 +- include/blt/std/assert.h | 19 ++++++++++++++++++- libraries/parallel-hashmap | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98ae500..e3c388f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 0.18.13) +set(BLT_VERSION 0.18.14) set(BLT_TEST_VERSION 0.0.1) set(BLT_TARGET BLT) diff --git a/include/blt/std/assert.h b/include/blt/std/assert.h index 0c6f4ef..a49313b 100644 --- a/include/blt/std/assert.h +++ b/include/blt/std/assert.h @@ -18,6 +18,23 @@ namespace blt void b_throw(const char* what, const char* path, int line); void b_abort(const char* what, const char* path, int line); + + struct abort_exception : public std::exception + { + public: + abort_exception() = default; + + explicit abort_exception(std::string error): error(std::move(error)) + {} + + [[nodiscard]] const char* what() const noexcept override + { + return error.c_str(); + } + + private: + std::string error; + }; } /** @@ -56,6 +73,6 @@ namespace blt #define BLT_THROW(throwable) do {blt::b_throw(throwable.what(), __FILE__, __LINE__); throw throwable;} while(0) -#define BLT_ABORT(message) do {blt::b_abort(message, __FILE__, __LINE__); std::abort(); } while (0) +#define BLT_ABORT(message) do {blt::b_abort(message, __FILE__, __LINE__); throw blt::abort_exception(); } while (0) #endif //BLT_ASSERT_H diff --git a/libraries/parallel-hashmap b/libraries/parallel-hashmap index d88c5e1..8a889d3 160000 --- a/libraries/parallel-hashmap +++ b/libraries/parallel-hashmap @@ -1 +1 @@ -Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b +Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6