bindings_error.h
| File Path | engine/include/conjure/bindings/bindings_error.h |
| API ↗ | Scripting from C#: the bindings, The native table |
The status codes (bindings_error.inl, append-only).
Enumerations
bindings_error
enum class bindings_error : u16 {
#define CONJURE_BINDINGS_STATUS_ENUMERATOR(name) name,
CONJURE_BINDINGS_FOR_EACH_STATUS(CONJURE_BINDINGS_STATUS_ENUMERATOR)
#undef CONJURE_BINDINGS_STATUS_ENUMERATOR
COUNT
};
The status codes (bindings_error.inl, append-only).
Constants
| Name | Type | Value | Description |
|---|---|---|---|
BINDINGS_ERROR_COUNT |
inline constexpr u32 |
static_ |
Number of status codes (COUNT itself excluded). |
LAST_ERROR_CAPACITY |
inline constexpr u32 |
512 |
Capacity of the last-error message buffer, terminator included (at most 511 message bytes). |
Macros
CONJURE_DECLARE_ERROR_CATEGORY
CONJURE_DECLARE_ERROR_CATEGORY(conjure::bindings::bindings_error, "bindings", conjure::bindings::bindings_error_name)
Functions
Public
bindings_error_name
bindings_error_name[[nodiscard]] CONJURE_API std::string_view bindings_error_name(
bindings_error code) noexcept;The stable upper-case enumerator name of a code ("ENTITY_NOT_ALIVE"); "" for unknown values.
clear_last_error
clear_last_errorCONJURE_API void clear_last_error() noexcept;Forgets the last failure.
fail
fail[[nodiscard]] CONJURE_API int32_t fail(
bindings_error code,
std::string_view entry,
std::string_view detail = {}) noexcept;Records "<entry>: <detail>" (detail may be empty) as the last error and returns to_status(code). Never allocates; a message longer than 511 bytes is truncated. Main thread only.
[[nodiscard]] CONJURE_API int32_t fail(
const core::error &failure,
std::string_view entry) noexcept;Maps a core::error of another module (2.2: ecs ENTITY_NOT_ALIVE / STRUCTURE_LOCKED / WRONG_THREAD / COMPONENT_NOT_PRESENT, assets NOT_FOUND / TYPE_MISMATCH, physics NO_BODY / NOT_A_CHARACTER, physics WRONG_BODY_KIND (to INVALID_ARGUMENT), scene INVALID_ENTITY / SCENE_NOT_LOADED / PREFAB_NOT_LOADED, everything else INTERNAL) and records its to_string() as the detail.
from_status
from_status[[nodiscard]] constexpr bindings_error from_status(
int32_t status) noexcept;The code behind a negative status; NONE for a success value, INTERNAL for an unknown code (INT32_MIN included).
last_error_code
last_error_code[[nodiscard]] CONJURE_API bindings_error last_error_code() noexcept;The code of the last recorded failure (NONE after clear_last_error).
last_error_message
last_error_message[[nodiscard]] CONJURE_API std::string_view last_error_message() noexcept;The message of the last recorded failure (empty after clear_last_error). The view stays valid until the next fail() or clear_last_error().
map_error
map_error[[nodiscard]] CONJURE_API bindings_error map_error(
const core::error &failure) noexcept;The code a core::error maps to (the table of fail(const core::error &, ...)).
to_status
to_status[[nodiscard]] constexpr int32_t to_status(
bindings_error code) noexcept;The ABI status of a code: -static_cast<int32_t>(code), so NONE is 0.