8 #ifndef LLUVIA_CORE_ERROR_H_
9 #define LLUVIA_CORE_ERROR_H_
15 #include <system_error>
95 template <
typename T = std::
string>
119 virtual const
char*
name() const noexcept
override {
return "ll::ErrorCode"; }
152 template <
typename T>
156 static_assert(std::is_convertible<T, std::string>(),
"T must be a string-like type");
172 template <
typename T>
176 static_assert(std::is_convertible<T, std::string>(),
"T must be a string-like type");
Class for error code category.
Definition: error.h:104
static ErrorCategory & getInstance() noexcept
Gets a singleton instance.
virtual const char * name() const noexcept override
Gets the error category name.
Definition: error.h:119
virtual std::string message(int ev) const override
Converts from an error code to a string message.
Definition: error.h:128
constexpr const std::array< std::tuple< const char *, ll::ErrorCode >, 26 > ErrorCodeStrings
Definition: error.h:57
std::string enumToString(E &&value) noexcept
Definition: enums.h:146
T errorCodeToString(ll::ErrorCode &&value) noexcept
Converts from ll::ErrorCode enum value to std::string.
Definition: error.h:96
void throwSystemErrorIf(bool condition, ll::ErrorCode errorCode, T &&msg)
Throws a std::system_error exception if the condition passed is true.
Definition: error.h:153
void throwSystemError(ll::ErrorCode errorCode, T &&msg)
Throws a std::system_error exception with error code and message.
Definition: error.h:173
std::error_code createErrorCode(ll::ErrorCode errorCode)
Creates an error code.
Definition: error.h:138
uint32_t enum_t
Definition: enums.h:23
ErrorCode
Error codes.
Definition: error.h:23
@ ProgramCompilationError
@ PhysicalDevicesNotFound
@ InvalidShaderFunctionName