[ox/std] Add Error::throwException()
This commit is contained in:
10
deps/ox/src/ox/std/error.hpp
vendored
10
deps/ox/src/ox/std/error.hpp
vendored
@@ -62,6 +62,8 @@ struct [[nodiscard]] Error {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
constexpr void throwException() const;
|
||||
|
||||
constexpr Error reoriginate(
|
||||
ErrorCode const pErrCode,
|
||||
CString const pMsg = nullptr,
|
||||
@@ -121,6 +123,14 @@ struct Exception: public std::exception {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
constexpr void Error::throwException() const {
|
||||
if (errCode) [[unlikely]] {
|
||||
throw Exception{*this};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[[noreturn]]
|
||||
void panic(
|
||||
Error const &err,
|
||||
|
||||
Reference in New Issue
Block a user