zerot
    Preparing search index...

    Class ContractViolationError

    Represents an error specifically indicating a violation of a contract condition. This error wraps an original error and provides context about the contract and layer where the violation occurred.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    category: ErrorCategory
    code?: string
    contractName: string

    The name of the contract that was violated.

    details?: Record<string, any>
    isRecoverable?: boolean
    layer: string

    The layer in which the contract violation occurred (e.g., "presentation", "business").

    originalError: ContractError | Error

    The original error that caused the contract violation.

    Methods

    • Provides an appropriate response object based on the contract's layer. This can be used by integration layers (e.g., Next.js Server Actions or Middleware) to return a user-friendly or system-appropriate response.

      Returns { error?: string; redirect?: string; success?: boolean }

      An object containing response details, such as redirect paths or error messages.