Module error

Module error 

Source
Expand description

Error types module with rich, actionable error information.

Provides comprehensive error types following ERRORS_PROMPT.md guidelines. All errors include error codes, error chaining, rich context, and actionable guidance. Uses trait-based approach for layer errors to eliminate duplication. Structured for both human and AI consumption.

§Macros

Error construction macros automatically capture source location:

use hexser::{hex_domain_error, error::codes};

let err = hex_domain_error!(
    codes::domain::INVARIANT_VIOLATION,
    "Order must have items",
    next_steps: ["Add at least one item"],
    suggestions: ["order.add_item(item)"]
);

Revision History

  • 2025-10-06T03:00:00Z @AI: Add error construction macros for Phase 2.
  • 2025-10-06T01:00:00Z @AI: Add RichError trait and LayerError generic for Phase 1.
  • 2025-10-06T00:00:00Z @AI: Add new error structs and source location for Phase 1.
  • 2025-10-01T00:00:00Z @AI: Initial Phase 1 error module structure.

Re-exports§

pub use codes as error_codes;
pub use hex_error::Hexserror;
pub use rich_error::RichError;

Modules§

adapter_error
Adapter-specific error types and utilities.
codes
Error code registry for hex crate errors.
conflict_error
Conflict error type for state conflicts.
domain_error
Domain-specific error types and utilities.
hex_error
Main error type for the hex crate.
layer_error
Generic layer error implementation.
not_found_error
Not found error type for missing resources.
port_error
Port-specific error types and utilities.
rich_error
Rich error trait for errors with context and guidance.
source_location
Source code location information for error tracking.
validation_error
Validation error type for input validation failures.