10static_assert(__cpp_lib_expected >= 202202L,
"VoltMod requires std::expected (C++23, P0323R12).");
64using Result = std::expected<T, Error>;
67using Status = std::expected<void, Error>;
ErrorCode
Why an operation did not produce a value.
@ NotFound
The named thing does not exist (no such player, convar, row).
@ Invalid
The caller's input does not parse or does not satisfy a precondition.
@ Denied
The caller lacks the permission the operation requires.
@ Engine
The engine or SDK refused, returned nothing, or is not where it was expected.
@ Immune
The target outranks the caller; a Denied that names the target, not the verb.
@ Unsupported
The build, the game version, or the gamedata does not offer this at all.
@ Failed
Anything else; the default so a value-initialized Error is never a false success.
@ NotReady
It exists but the subsystem behind it is not usable yet.
static std::string ReadFile(const std::filesystem::path &path)
std::expected< void, Error > Status
std::expected< T, Error > Result
One failure: a code to branch on, text for the log, and an optional translation key.
static Error Failed(std::string detail)
static Error Denied(std::string key)
static Error Invalid(std::string detail)
static Error Immune(std::string key)
static Error Engine(std::string detail)
static Error Unsupported(std::string detail)
static Error NotFound(std::string detail)
static Error NotReady(std::string detail)