doctor give me exceptions
parent
394dff9cc4
commit
7a551435a0
|
@ -1,7 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
include(cmake/color.cmake)
|
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_TEST_VERSION 0.0.1)
|
||||||
|
|
||||||
set(BLT_TARGET BLT)
|
set(BLT_TARGET BLT)
|
||||||
|
|
|
@ -18,6 +18,23 @@ namespace blt
|
||||||
void b_throw(const char* what, const char* path, int line);
|
void b_throw(const char* what, const char* path, int line);
|
||||||
|
|
||||||
void b_abort(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_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
|
#endif //BLT_ASSERT_H
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b
|
Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6
|
Loading…
Reference in New Issue