waddling-errors-macros 0.7.3

Procedural macros for structured error codes with compile-time validation and taxonomy enforcement
Documentation
//! Sequence Number Conventions
//!
//! Following SEQUENCE-CONVENTIONS.md v0.2.0
//!
//! Sequences provide semantic meaning to error codes:
//! - 001-010: Input/Data validation (MISSING, INVALID, etc.)
//! - 011-020: State/Lifecycle (TIMEOUT, STALE, IN_PROGRESS, etc.)
//! - 021-030: Resource/Storage (NOTFOUND, EXHAUSTED, CORRUPTED, etc.)
//! - 999: Success/Completion
//!
//! This version uses the `sequence!` macro from waddling-errors-macros.

use waddling_errors::component_location;
use waddling_errors_macros::sequence;

component_location!(Api);

sequence! {
    MISSING(1) {
        description: "Required parameter, field, or argument is absent",
        typical_severity: "Error",
        hints: [
            "Check if parameter was provided",
            "Verify required fields are set",
        ],
    },

    MISMATCH(2) {
        description: "Type or value doesn't match expected format",
        typical_severity: "Error",
        hints: [
            "Verify data type",
            "Check value format",
        ],
    },

    INVALID(3) {
        description: "Validation failed - data doesn't meet constraints",
        typical_severity: "Error",
        hints: [
            "Review validation rules",
            "Check input format",
        ],
    },

    DUPLICATE(7) {
        description: "Duplicate entry or rate limit violation",
        typical_severity: "Blocked",
        hints: [
            "Check for existing entries",
            "Implement backoff strategy",
        ],
    },

    DENIED(8) {
        description: "Access denied - insufficient permissions",
        typical_severity: "Error",
        hints: [
            "Verify permissions",
            "Check authorization",
        ],
    },

    CANCELLED(14) {
        description: "Operation cancelled by user or system",
        typical_severity: "Error",
        hints: [
            "Check cancellation reason",
            "Retry if needed",
        ],
    },

    IN_PROGRESS(15) {
        description: "Operation still in progress",
        typical_severity: "Blocked",
        hints: [
            "Wait for completion",
            "Check progress status",
        ],
    },

    TIMEOUT(17) {
        description: "Operation exceeded time limit",
        typical_severity: "Error",
        hints: [
            "Increase timeout",
            "Optimize operation",
            "Check for blocking",
        ],
    },

    STALE(18) {
        description: "Data is outdated and needs refresh",
        typical_severity: "Warning",
        hints: [
            "Refresh from source",
            "Adjust TTL settings",
        ],
    },

    NOT_FOUND(21) {
        description: "Requested resource does not exist",
        typical_severity: "Error",
        hints: [
            "Verify resource identifier",
            "Check if resource was deleted",
        ],
    },

    ALREADY_EXISTS(22) {
        description: "Resource already exists - creation conflict",
        typical_severity: "Error",
        hints: [
            "Use update instead of create",
            "Check unique constraints",
        ],
    },

    CONFLICT(23) {
        description: "Concurrent modification or version conflict",
        typical_severity: "Error",
        hints: [
            "Retry with latest version",
            "Implement optimistic locking",
        ],
    },

    CORRUPTED(25) {
        description: "Data integrity failure - corruption detected",
        typical_severity: "Critical",
        hints: [
            "Restore from backup",
            "Verify checksums",
            "Check storage health",
        ],
    },

    EXHAUSTED(26) {
        description: "Resource pool or quota completely used",
        typical_severity: "Critical",
        hints: [
            "Scale up resources",
            "Implement resource limits",
            "Review capacity planning",
        ],
    },

    UNAVAILABLE(27) {
        description: "Service temporarily unavailable",
        typical_severity: "Error",
        hints: [
            "Retry after delay",
            "Check service status",
            "Enable fallback",
        ],
    },

    UNREACHABLE(28) {
        description: "Network connectivity failure",
        typical_severity: "Error",
        hints: [
            "Check network",
            "Verify endpoint",
            "Review DNS",
        ],
    },

    COMPLETE(999) {
        description: "Operation completed successfully",
        typical_severity: "Success",
        hints: [
            "Operation successful",
            "Check results",
        ],
    },

    EXCEEDED(30) {
        description: "Limit or threshold exceeded",
        typical_severity: "Error",
        hints: [
            "Check rate limits",
            "Review quota settings",
        ],
    },

    EXPIRED(31) {
        description: "Resource or token has expired",
        typical_severity: "Error",
        hints: [
            "Renew token",
            "Check expiration time",
        ],
    },

    MALFORMED(32) {
        description: "Malformed data or request",
        typical_severity: "Error",
        hints: [
            "Check data format",
            "Validate input structure",
        ],
    },

    LIMITED(33) {
        description: "Resource access is limited",
        typical_severity: "Warning",
        hints: [
            "Check access permissions",
            "Review resource limits",
        ],
    },

    MISS(34) {
        description: "Cache miss occurred",
        typical_severity: "Info",
        hints: [
            "Data not in cache",
            "Will fetch from source",
        ],
    },

    WARMED(35) {
        description: "Cache has been warmed",
        typical_severity: "Success",
        hints: [
            "Cache is ready",
            "Performance optimized",
        ],
    },

    COMPLETED(36) {
        description: "Task completed",
        typical_severity: "Success",
        hints: [
            "Task finished successfully",
            "Check results",
        ],
    },

    UPLOADED(37) {
        description: "File uploaded successfully",
        typical_severity: "Success",
        hints: [
            "Upload complete",
            "File is available",
        ],
    },

    TRACE(38) {
        description: "Trace logging event",
        typical_severity: "Trace",
        hints: [
            "Detailed trace information",
            "For debugging purposes",
        ],
    },

    DETECTED(39) {
        description: "Condition or state detected",
        typical_severity: "Warning",
        hints: [
            "Review detected condition",
            "Take appropriate action",
        ],
    },
}

// Note: Sequences now use the sequence! macro with auto-registration.
// The macro generates constants, metadata, AND #[ctor] registration functions.
// No manual registration function needed!
// Sequences automatically register themselves at startup, just like components and primaries.