[ox/std] Add Error::throwException()

This commit is contained in:
2026-02-07 14:12:07 -06:00
parent 54d7c706eb
commit 93d16cafb2

View File

@@ -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,