diff --git a/deps/ox/src/ox/std/error.hpp b/deps/ox/src/ox/std/error.hpp index 18269314..ef0d7bbe 100644 --- a/deps/ox/src/ox/std/error.hpp +++ b/deps/ox/src/ox/std/error.hpp @@ -37,7 +37,7 @@ using ErrorCode = uint16_t; struct [[nodiscard]] Error { std::source_location src; - ox::CString msg = nullptr; + CString msg = nullptr; ErrorCode errCode = 0; constexpr Error() noexcept = default; @@ -51,7 +51,7 @@ struct [[nodiscard]] Error { explicit constexpr Error( ErrorCode const errCode, - ox::CString msg, + CString const msg, std::source_location const &src = std::source_location::current()) noexcept: src{src}, msg{msg}, @@ -62,6 +62,18 @@ struct [[nodiscard]] Error { return errCode; } + constexpr Error reoriginate( + ErrorCode const pErrCode, + CString const pMsg = nullptr, + std::source_location const &pSrc = std::source_location::current()) const noexcept { + return Error{pErrCode, pMsg, pSrc}; + } + + constexpr Error reoriginate( + std::source_location const &pSrc = std::source_location::current()) const noexcept { + return Error{errCode, msg, pSrc}; + } + }; [[nodiscard]] @@ -112,13 +124,13 @@ struct Exception: public std::exception { [[noreturn]] void panic( Error const &err, - char const *panicMsg, + CString panicMsg, std::source_location const &src = std::source_location::current()) noexcept; template struct [[nodiscard]] Result { - using type = typename remove_reference::type; + using type = remove_reference_t; T value; Error error;