summaryrefslogtreecommitdiff
path: root/deimos/core
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2024-06-09 23:34:38 +0200
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2024-06-09 23:34:38 +0200
commit55bc67bf7989acfeadf0233a4bdd5660e8f0bb69 (patch)
treeab61b00bfd351c32cc99298f4466c86baf6d1514 /deimos/core
parent909304e44763c58c0ebbe40068a58784ebaced7b (diff)
Start work on render backend
Diffstat (limited to 'deimos/core')
-rw-r--r--deimos/core/os_win32.cpp2
-rw-r--r--deimos/core/status.cpp7
-rw-r--r--deimos/core/status.h10
3 files changed, 13 insertions, 6 deletions
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<int32_t> ref_count;
- StatusCode code{};
- StringView message;
+ Atomic<int32_t> 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");
}
}