error¶
| Type | Class |
| Namespace | conjure::core |
| Include File Path | engine/include/conjure/core/error.h |
| Source File Path | engine/src/core/foundation/error.cpp |
| API ↗ | Errors and results |
Syntax¶
Constructors¶
| Access | Signature | Description |
|---|---|---|
| public | error(); | |
| public | explicit error(
error_code code); | |
| public | error(
error_code code,
std::string message); | |
| public | error(
u32 category,
u32 code,
const char *categoryName,
error_code_name_fn codeName,
std::string message); | |
| public | error(
const error &) = default; | |
| public | error(
error &&) noexcept = default; |
Destructors¶
| Access | Signature | Description |
|---|---|---|
| public | ~error(); |
Variables¶
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mCategory | u32 | 0 | |
| private | m | const char * | "" | |
| private | mCode | u32 | 0 | |
| private | mCodeName | error_code_name_fn | nullptr | |
| private | mMessage | std::string | {} |
Functions¶
Public¶
category¶
category¶[[nodiscard]] u32 category() const noexcept;FNV-1a 32 hash of the category name. A default-constructed error carries the core category (error_category_traits<error_code>::ID) with code NONE; test for "no error" with is(error_code::NONE), not with category() == 0.
category_name¶
category_name¶[[nodiscard]] std::string_view category_name() const noexcept;The category's registered name ("core", "ecs", ...).
code_name¶
code_name¶[[nodiscard]] std::string_view code_name() const noexcept;The enumerator name of the code within its category, or "" when unknown.
from¶
from¶template <error_enum EnumType> [[nodiscard]] static error from(
EnumType code,
std::string message = {});generic_code¶
generic_code¶[[nodiscard]] error_code generic_code() const noexcept;The generic code when this error belongs to the core category, otherwise NONE.
is¶
is¶template <error_enum EnumType> [[nodiscard]] bool is(
EnumType code) const noexcept;True when this error carries exactly this code of this category.
is_category¶
is_category¶template <error_enum EnumType> [[nodiscard]] bool is_category() const noexcept;True when this error belongs to the category bound to the given enumeration.
message¶
message¶[[nodiscard]] const std::string &message() const noexcept;Human readable detail; may be empty.
to_string¶
to_string¶[[nodiscard]] std::string to_string() const;"category.CODE: message", or "category.CODE" when there is no message.
Operator Overloads¶
Public¶
operator=¶
operator=¶