From 55bc67bf7989acfeadf0233a4bdd5660e8f0bb69 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Sun, 9 Jun 2024 23:34:38 +0200 Subject: Start work on render backend --- deimos/core/os_win32.cpp | 2 +- deimos/core/status.cpp | 7 ++++--- deimos/core/status.h | 10 ++++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'deimos/core') diff --git a/deimos/core/os_win32.cpp b/deimos/core/os_win32.cpp index 84fc3a3..9a8233d 100644 --- a/deimos/core/os_win32.cpp +++ b/deimos/core/os_win32.cpp @@ -169,7 +169,7 @@ public: if (hwnd == nullptr) { - return InternalError("Error while creating Win32 window"); + return RuntimeError("Error while creating Win32 window"); } ::ShowWindow(hwnd, SW_SHOW); diff --git a/deimos/core/status.cpp b/deimos/core/status.cpp index 10965bc..2d9e7c2 100644 --- a/deimos/core/status.cpp +++ b/deimos/core/status.cpp @@ -18,14 +18,15 @@ StringView StatusCodeToString(StatusCode code) case StatusCode::kInvalidArgument: return StringView("Invalid argument"); case StatusCode::kUnimplemented: return StringView("Unimplemented"); case StatusCode::kInternal: return StringView("Internal error"); + case StatusCode::kRuntime: return StringView("Runtime error"); } } struct StatusRep { - Atomic ref_count; - StatusCode code{}; - StringView message; + Atomic ref_count; + StatusCode code{}; + StringView message; }; Status::Status(StatusCode code, StringView message) diff --git a/deimos/core/status.h b/deimos/core/status.h index 8141dad..3738ae9 100644 --- a/deimos/core/status.h +++ b/deimos/core/status.h @@ -14,6 +14,7 @@ enum class StatusCode : uint32_t kInvalidArgument, kUnimplemented, kInternal, + kRuntime, }; StringView StatusCodeToString(StatusCode code); @@ -106,6 +107,11 @@ inline Status InternalError(StringView message = {}) return Status(StatusCode::kInternal, message); } +inline Status RuntimeError(StringView message = {}) +{ + return Status(StatusCode::kRuntime, message); +} + namespace statusor_internals { }; @@ -150,7 +156,7 @@ public: Expects(!m_status.ok()); if (m_status.ok()) { - m_status = InternalError("StatusOr constructed from OK"); + m_status = InvalidArgumentError("StatusOr constructed from OK"); } } @@ -159,7 +165,7 @@ public: Expects(!m_status.ok()); if (m_status.ok()) { - m_status = InternalError("StatusOr constructed from OK"); + m_status = InvalidArgumentError("StatusOr constructed from OK"); } } -- cgit