
    i
                         d Z ddlmZmZ  G d de          Z G d de          Z G d dee          Z G d	 d
e          ZdS )u   
JMAP error hierarchy.

Extends the existing caldav.lib.error.DAVError base so that JMAP errors
integrate naturally with existing exception handling in user code.

RFC 8620 §3.6.2 defines the standard method-level error types.
    )AuthorizationErrorDAVErrorc            	       j     e Zd ZU dZdZeed<   	 	 	 d
dedz  dedz  dedz  ddf fdZdefd	Z xZ	S )	JMAPErrorzBase class for all JMAP errors.

    Adds ``error_type`` to carry the RFC 8620 error type string
    (e.g. ``"unknownMethod"``, ``"invalidArguments"``).
    serverError
error_typeNurlreasonreturnc                 d    t                                          ||           |	|| _        d S d S )N)r	   r
   )super__init__r   )selfr	   r
   r   	__class__s       L/root/projects/butler/venv/lib/python3.11/site-packages/caldav/jmap/error.pyr   zJMAPError.__init__   s;     	S000!(DOOO "!    c                 N    | j         j        d| j        d| j        d| j        S )Nz (type=z) at 'z', reason: )r   __name__r   r	   r
   )r   s    r   __str__zJMAPError.__str__    s3    N###OOOHHHKK	
 	
r   )NNN)
r   
__module____qualname____doc__r   str__annotations__r   r   __classcell__)r   s   @r   r   r      s           $J### !!%	) )4Z) d
) $J	)
 
) ) ) ) ) )
 
 
 
 
 
 
 
 
r   r   c                       e Zd ZdZdZdZdS )JMAPCapabilityErrorzServer does not advertise the required JMAP capability.

    Raised when the Session object returned by the server does not include
    ``urn:ietf:params:jmap:calendars`` in the account capabilities.
    capabilityNotSupportedz6Server does not support urn:ietf:params:jmap:calendarsNr   r   r   r   r   r
    r   r   r   r   )   s$          *JEFFFr   r   c                       e Zd ZdZdZdZdS )JMAPAuthErrorzHTTP 401 or 403 received from JMAP server.

    Unlike CalDAV, JMAP does not use a 401-challenge-retry dance.
    A 401/403 on the session GET or any API call is a hard failure.
    	forbiddenzAuthentication failedNr   r    r   r   r"   r"   4   s$          J$FFFr   r"   c                       e Zd ZdZdZdS )JMAPMethodErroru  A JMAP method call returned an error response.

    RFC 8620 §3.6.2 error types that may be set as ``error_type``:

    - ``serverError``             — unexpected server-side error
    - ``unknownMethod``           — method name not recognised
    - ``invalidArguments``        — bad argument types or values
    - ``invalidResultReference``  — bad ``#result`` reference
    - ``forbidden``               — not allowed to perform this call
    - ``accountNotFound``         — ``accountId`` does not exist
    - ``accountNotSupportedByMethod`` — account lacks needed capability
    - ``accountReadOnly``         — account is read-only
    - ``requestTooLarge``         — request exceeds server limits
    - ``stateMismatch``           — ``ifInState`` check failed
    - ``serverPartialFail``       — partial failure; some calls succeeded
    - ``notFound``                — requested object does not exist
    - ``notDraft``                — object is not in draft state
    r   N)r   r   r   r   r   r    r   r   r%   r%   ?   s         & JJJr   r%   N)r   caldav.lib.errorr   r   r   r   r"   r%   r    r   r   <module>r'      s     : 9 9 9 9 9 9 9
 
 
 
 
 
 
 
8F F F F F) F F F% % % % %&	 % % %    i     r   