
    Ki                     J    d Z  G d de      Z G d de      Z G d de      Zy)z&Exceptions for the Django hook system.c                       e Zd ZdZy)HookSystemErrorz*Base exception for hook system operations.N)__name__
__module____qualname____doc__     h/home/cursorai/projects/django-wallet-utils/venv/lib/python3.12/site-packages/django_hooks/exceptions.pyr   r      s    4r	   r   c                   :     e Zd ZdZ	 ddedededz  f fdZ xZS )HookRejectionErrora"  
    Raised by PRE hooks to reject an operation.

    This exception allows PRE hooks to reject an operation before it executes,
    providing a machine-readable error code and human-readable message for
    frontend display.

    Attributes:
        error_code: Machine-readable error code in ALL_CAPS format (e.g., 'DAILY_LIMIT_EXCEEDED')
        message: Human-readable error message for display
        details: Optional dictionary with additional context for error handling

    Example:
        raise HookRejectionError(
            error_code="DAILY_LIMIT_EXCEEDED",
            message="You have exceeded your daily transaction limit of $500",
            details={
                "limit": 500,
                "current_total": 650,
                "remaining": 0,
            }
        )
    N
error_codemessagedetailsc                 V    t         |   |       || _        || _        |xs i | _        y N)super__init__r   r   r   )selfr   r   r   	__class__s       r
   r   zHookRejectionError.__init__#   s+     	!$}"r	   r   )r   r   r   r   strdictr   __classcell__r   s   @r
   r   r   
   s7    8  $		%	% 	% 		% 	%r	   r   c                   0     e Zd ZdZdededef fdZ xZS )HookExecutionErrora  
    Raised when a hook fails to execute due to an internal error.

    This is different from HookRejectionError - it represents a bug or system
    failure in the hook itself, not a business rule rejection.

    Attributes:
        message: Error description
        hook_name: Name of the hook that failed
        original_exception: The underlying exception that caused the failure
    r   	hook_nameoriginal_exceptionc                 @    t         |   |       || _        || _        y r   )r   r   r   r   )r   r   r   r   r   s       r
   r   zHookExecutionError.__init__<   s    !""4r	   )r   r   r   r   r   	Exceptionr   r   r   s   @r
   r   r   /   s'    
5 5 5 5 5r	   r   N)r   r   r   r   r   r   r	   r
   <module>r       s-    ,	i 	"% "%J5 5r	   