From 93d16cafb21df4794420e26cf54fab91eb9ab7b7 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 7 Feb 2026 14:12:07 -0600 Subject: [PATCH] [ox/std] Add Error::throwException() --- deps/ox/src/ox/std/error.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/deps/ox/src/ox/std/error.hpp b/deps/ox/src/ox/std/error.hpp index e440f7bb..a9eff7eb 100644 --- a/deps/ox/src/ox/std/error.hpp +++ b/deps/ox/src/ox/std/error.hpp @@ -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,