45#ifndef RTYPE_CORE_ERROR_HPP_
46 #define RTYPE_CORE_ERROR_HPP_
53 #include <string_view>
54 #include <system_error>
117 struct is_error_code_enum<
rtp::ErrorCode> : true_type {};
121struct std::formatter<
rtp::ErrorCode> : std::formatter<std::string_view> {
130 return std::formatter<std::string_view>::format(
rtp::toString(e), ctx);
166 template <
typename ...Args>
169 std::format_string<Args...> fmt,
170 Args &&...args) ->
Error;
180 template <
typename ...Args>
183 std::format_string<Args...> fmt,
184 Args &&...args) ->
Error;
194 template <
typename ...Args>
197 std::format_string<Args...> fmt,
198 Args &&...args) ->
Error;
226 auto message(
void)
const noexcept
259struct std::formatter<
rtp::Error> : std::formatter<std::string> {
268 return std::format_to(ctx.out(),
"[{}] {}: {}",
Log severity levels for the logging system.
Comprehensive error object with severity and retry tracking.
ErrorCode _code
The error code.
static auto warning(ErrorCode code, std::format_string< Args... > fmt, Args &&...args) -> Error
Create a warning-level error.
std::uint8_t retryCount(void) const noexcept
Get the current retry count.
log::Level _severity
Severity level of the error.
static auto failure(ErrorCode code, std::format_string< Args... > fmt, Args &&...args) -> Error
Create a failure-level error.
log::Level severity(void) const noexcept
Get the severity level of this error.
auto message(void) const noexcept -> std::string_view
Get the error message.
std::uint8_t _retryCount
Number of retry attempts.
std::string _message
Formatted error message.
ErrorCode code(void) const noexcept
Get the error code.
std::uint8_t incrementRetryCount(void) noexcept
Increment the retry counter.
static auto fatal(ErrorCode code, std::format_string< Args... > fmt, Args &&...args) -> Error
Create a fatal-level error.
Level
Severity levels for log messages.
ErrorCode
Enumeration of all possible error codes in the RType engine.
@ FileNotFound
Requested file does not exist.
@ InvalidParameter
Invalid function parameter provided.
@ LibraryLoadFailed
Failed to load dynamic library.
@ InternalRuntimeError
Internal runtime error.
@ ComponentMissing
Requested component not found on entity.
@ Unknown
Unknown or unspecified error.
@ EntityInvalid
Entity identifier is invalid or stale.
@ ConnectionFailed
Failed to establish network connection.
@ RegistryFull
Entity registry has reached maximum capacity.
@ SymbolNotFound
Symbol not found in dynamic library.
@ Timeout
Network operation timed out.
@ InvalidFormat
Invalid file or data format.
@ Disconnected
Connection was disconnected.
@ PayloadError
Error in network payload data.
std::error_code make_error_code(ErrorCode e) noexcept
Create a std::error_code from an ErrorCode.
const std::error_category & rtype_category(void) noexcept
Get the RType error category for std::error_code integration.
constexpr std::string_view toString(ErrorCode e) noexcept
Convert an ErrorCode to its string representation.