[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;
|
return errCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr void throwException() const;
|
||||||
|
|
||||||
constexpr Error reoriginate(
|
constexpr Error reoriginate(
|
||||||
ErrorCode const pErrCode,
|
ErrorCode const pErrCode,
|
||||||
CString const pMsg = nullptr,
|
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]]
|
[[noreturn]]
|
||||||
void panic(
|
void panic(
|
||||||
Error const &err,
|
Error const &err,
|
||||||
|
|||||||
Reference in New Issue
Block a user