Expand description
Error handling infrastructure for GoudEngine.
This is the canonical Foundation layer location for error types.
libs/error/ re-exports from here so both import paths work identically.
§Error Code Ranges
Error codes are organized into ranges by category:
| Range | Category | Description |
|---|---|---|
| 0 | Success | Operation completed successfully |
| 1-99 | Context | Initialization and context errors |
| 100-199 | Resource | Asset and resource management errors |
| 200-299 | Graphics | Rendering and GPU errors |
| 300-399 | Entity | ECS entity and component errors |
| 400-499 | Input | Input handling errors |
| 500-599 | System | Platform and system errors |
| 600-699 | Provider | Provider subsystem errors |
| 900-999 | Internal | Unexpected internal errors |
§FFI Compatibility
Error codes use i32 for maximum C ABI compatibility. Negative values
are reserved for future use (e.g., platform-specific errors).
Re-exports§
pub use context::GoudErrorContext;pub use recovery::is_fatal;pub use recovery::is_recoverable;pub use recovery::recovery_class;pub use recovery::recovery_hint;pub use recovery::RecoveryClass;
Modules§
- context
- Error context propagation for GoudEngine.
- recovery
- Error recovery classification for GoudEngine error codes.
Structs§
- GoudFFI
Result - FFI-safe result type for returning success/failure status across the FFI boundary.
Enums§
- Goud
Error - The main error type for GoudEngine.
Constants§
- CONTEXT_
ERROR_ BASE - Base code for context/initialization errors.
- ENTITY_
ERROR_ BASE - Base code for ECS entity errors.
- ERR_
ALREADY_ INITIALIZED - Engine has already been initialized. Recovery: shut down the engine before re-initializing.
- ERR_
AUDIO_ INIT_ FAILED - Audio system initialization failed. Recovery: check that an audio output device is available.
- ERR_
BACKEND_ NOT_ SUPPORTED - Graphics backend not supported on this platform. Recovery: update GPU drivers or select a different supported backend.
- ERR_
BUFFER_ CREATION_ FAILED - Buffer creation failed. Recovery: reduce buffer size or free unused GPU buffers.
- ERR_
COMPONENT_ ALREADY_ EXISTS - Component already exists on entity. Recovery: use replace/update instead of add, or remove the existing component first.
- ERR_
COMPONENT_ NOT_ FOUND - Component was not found on entity. Recovery: attach the component before accessing it, or check with a has-component query.
- ERR_
CONTEXT_ DESTROYED - Engine context has been destroyed. Recovery: re-initialize the engine to obtain a new context.
- ERR_
DRAW_ CALL_ FAILED - Draw call failed. Recovery: verify buffer bindings and shader state; try updating GPU drivers.
- ERR_
ENTITY_ ALREADY_ EXISTS - Entity already exists. Recovery: use a different entity ID or remove the existing entity first.
- ERR_
ENTITY_ NOT_ FOUND - Entity was not found. Recovery: verify the entity ID is valid and has not been despawned.
- ERR_
HANDLE_ EXPIRED - Handle refers to a resource that has been deallocated. Recovery: re-create the resource to get a new handle.
- ERR_
HANDLE_ TYPE_ MISMATCH - Handle type does not match expected resource type. Recovery: pass the correct handle type for the operation.
- ERR_
INITIALIZATION_ FAILED - Engine initialization failed (generic).
Specific error message available via
last_error_message(). Recovery: check the error message for details and verify dependencies. - ERR_
INPUT_ DEVICE_ NOT_ FOUND - Input device not found or disconnected. Recovery: verify the input device is connected and recognized by the OS.
- ERR_
INTERNAL_ ERROR - Internal engine error (unexpected state). Recovery: report the error with full details; this is likely an engine bug.
- ERR_
INVALID_ CONTEXT - Invalid engine context. Recovery: ensure the context was properly created and not corrupted.
- ERR_
INVALID_ HANDLE - Handle is invalid (null or malformed). Recovery: ensure the handle was obtained from a valid creation call.
- ERR_
INVALID_ INPUT_ ACTION - Invalid input action name. Recovery: check the action name matches a registered input action.
- ERR_
INVALID_ STATE - Invalid engine state. Recovery: check the sequence of API calls; the engine may need re-initialization.
- ERR_
NOT_ IMPLEMENTED - Feature not yet implemented. Recovery: use an alternative approach or wait for the feature to be implemented.
- ERR_
NOT_ INITIALIZED - Engine has not been initialized. Recovery: call the initialization function first.
- ERR_
PHYSICS_ INIT_ FAILED - Physics system initialization failed. Recovery: review physics configuration for invalid values.
- ERR_
PLATFORM_ ERROR - Generic platform error. Recovery: check the error message for platform-specific details.
- ERR_
PROVIDER_ INIT_ FAILED - Provider initialization failed.
- ERR_
PROVIDER_ NOT_ FOUND - Provider was not found or not registered.
- ERR_
PROVIDER_ OPERATION_ FAILED - Provider operation failed.
- ERR_
QUERY_ FAILED - Query execution failed. Recovery: check for conflicting mutable/immutable access on the same component.
- ERR_
RENDER_ TARGET_ FAILED - Render target creation failed. Recovery: verify attachment formats and dimensions are consistent.
- ERR_
RESOURCE_ ALREADY_ EXISTS - Resource with this identifier already exists. Recovery: use a unique identifier or remove the existing resource first.
- ERR_
RESOURCE_ INVALID_ FORMAT - Resource format is invalid or unsupported. Recovery: verify the file is not corrupted and uses a supported format.
- ERR_
RESOURCE_ LOAD_ FAILED - Failed to load resource from source. Recovery: check file permissions and ensure the file is not locked.
- ERR_
RESOURCE_ NOT_ FOUND - Requested resource was not found. Recovery: verify the file path and check the working directory.
- ERR_
SHADER_ COMPILATION_ FAILED - Shader compilation failed. Recovery: review shader source; the error message contains GPU compiler output.
- ERR_
SHADER_ LINK_ FAILED - Shader program linking failed. Recovery: verify shader stage inputs/outputs match and uniforms are declared.
- ERR_
TEXTURE_ CREATION_ FAILED - Texture creation failed. Recovery: check texture dimensions and format; reduce size or free GPU resources.
- ERR_
WINDOW_ CREATION_ FAILED - Window creation failed. Recovery: verify display server is running and window parameters are valid.
- GRAPHICS_
ERROR_ BASE - Base code for graphics/rendering errors.
- INPUT_
ERROR_ BASE - Base code for input handling errors.
- INTERNAL_
ERROR_ BASE - Base code for internal/unexpected errors.
- PROVIDER_
ERROR_ BASE - Base code for provider errors.
- RESOURCE_
ERROR_ BASE - Base code for resource/asset errors.
- SUCCESS
- Operation completed successfully.
- SYSTEM_
ERROR_ BASE - Base code for system/platform errors.
Functions§
- clear_
last_ error - Clears the last error for the current thread.
- error_
category - Returns the category name for an error code.
- get_
last_ error - Gets the last error from the current thread without clearing it.
- is_
error - Returns true if the error code indicates an error.
- is_
success - Returns true if the error code indicates success.
- last_
error_ code - Returns the error code of the last error for the current thread.
- last_
error_ message - Returns the error message of the last error for the current thread.
- last_
error_ operation - Returns the operation from the last error’s context, if set.
- last_
error_ subsystem - Returns the subsystem from the last error’s context, if set.
- set_
last_ error - Sets the last error for the current thread.
- set_
last_ error_ with_ context - Sets the last error and its context for the current thread.
- take_
last_ error - Takes the last error from the current thread, clearing it.
Type Aliases§
- Goud
Error Code - FFI-compatible error code type.
- Goud
Result - A specialized
Resulttype for GoudEngine operations.