
    ?h@                     (   d Z ddlmZmZ ddiZ G d de      Z G d de      Z G d	 d
e      Z G d de      Z	 G d de      Z
 G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)z
Weaviate Exceptions.
    )Response
exceptionsi  zxPayload Too Large. Try to decrease the batch size or increase the maximum request size on your weaviate
         server.c                   *     e Zd ZdZddef fdZ xZS )WeaviateBaseErrorz
    Weaviate base exception that all Weaviate exceptions should inherit from.
    This error can be used to catch any Weaviate exceptions.
    messagec                 2    || _         t        | 	  |       y)z
        Weaviate base exception initializer.
        Parameters
        ----------
        message: str, optional
            An error message specific to the context in which the error occurred.
        N)r   super__init__)selfr   	__class__s     Q/home/chris/cleankitchens-env/lib/python3.12/site-packages/weaviate/exceptions.pyr
   zWeaviateBaseError.__init__   s     !    ) __name__
__module____qualname____doc__strr
   __classcell__r   s   @r   r   r      s    

" 
" 
"r   r   c                   B     e Zd ZdZdedef fdZedefd       Z	 xZ
S )UnexpectedStatusCodeExceptionz
    Is raised in case the status code returned from Weaviate is
    not handled in the client implementation and suggests an error.
    r   responsec                     |j                   | _        	 |j                         }|d|j                    d| dz   }|j                   t
        v r|dt
        |j                      z   z  }t        |   |       y# t        j                  $ r d}Y hw xY w)a  
        Is raised in case the status code returned from Weaviate is
        not handled in the client implementation and suggests an error.

        Custom code can act on the attributes:
        - status_code
        - json

        Parameters
        ----------
        message: str
            An error message specific to the context, in which the error occurred.
        response: requests.Response
            The request response of which the status code was unexpected.
        Nz! Unexpected status code: z, with response body: . )status_code_status_codejsonr   JSONDecodeErrorERROR_CODE_EXPLANATIONr	   r
   )r   r   r   bodymsgr   s        r   r
   z&UnexpectedStatusCodeException.__init__&   s      "*!5!5	==?D
 *8+?+?*@@VW[V\\]^_ 	 #993/0D0DEEEC )) 	D	s   A5 5BBreturnc                     | j                   S Nr   r   s    r   r   z)UnexpectedStatusCodeException.status_codeG          r   )r   r   r   r   r   r   r
   propertyintr   r   r   s   @r   r   r       s7    
 x B !S ! !r   r   c                   >     e Zd Zdedef fdZedefd       Z xZ	S ) ResponseCannotBeDecodedExceptionlocationr   c                 p    d| d|j                    d| }t        | 	  |       |j                  | _        y)a(  Raised when a weaviate response cannot be decoded to json

        Parameters
        ----------
        location: str
            From which code path the exception was raised.
        response: requests.Response
            The request response of which the status code was unexpected.
        z%Cannot decode response from weaviate z with content z for request from N)textr	   r
   r   r   )r   r/   r   r$   r   s       r   r
   z)ResponseCannotBeDecodedException.__init__M   s?     6hZ~hmm_\nownxy!)!5!5r   r%   c                     | j                   S r'   r(   r)   s    r   r   z,ResponseCannotBeDecodedException.status_code[   r*   r   )
r   r   r   r   r   r
   r+   r,   r   r   r   s   @r   r.   r.   L   s1    6 6 6 !S ! !r   r.   c                       e Zd ZdZy)ObjectAlreadyExistsExceptionz*
    Object Already Exists Exception.
    Nr   r   r   r    r   r   r4   r4   `       r   r4   c                       e Zd ZdZy)AuthenticationFailedExceptionz*
    Authentication Failed Exception.
    Nr5   r6   r   r   r9   r9   f   r7   r   r9   c                       e Zd ZdZy)SchemaValidationExceptionz&
    Schema Validation Exception.
    Nr5   r6   r   r   r;   r;   l   r7   r   r;   c                       e Zd ZdZy)BackupFailedExceptionz"
    Backup Failed Exception.
    Nr5   r6   r   r   r=   r=   r   r7   r   r=   c                       e Zd ZdZy)EmptyResponseExceptionzL
    Occurs when an HTTP request unexpectedly returns an empty response
    Nr5   r6   r   r   r?   r?   x   r7   r   r?   c                       e Zd ZdZy)MissingScopeExceptionz3Scope was not provided with client credential flow.Nr5   r6   r   r   rA   rA   ~   s    =r   rA   c                   ,     e Zd ZdZdedef fdZ xZS )AdditionalPropertiesExceptionz3Additional properties were provided multiple times.additional_dictadditional_dataclassc                 6    d| d| d}t         |   |       y )Nz
        Cannot add AdditionalProperties class together with string-additional properties. Did you call
            .with_additional() multiple times?.
             Current additional properties already present:
                - strings: z/
                - AdditionalProperties class: z	
        r	   r
   )r   rD   rE   r$   r   s       r   r
   z&AdditionalPropertiesException.__init__   s7     ,, -//C.D E	 	r   r   r   s   @r   rC   rC      s    = 3  r   rC   c                       e Zd ZdZy)WeaviateStartUpErrorz0Is raised if weaviate does not start up in time.Nr5   r6   r   r   rI   rI      s    :r   rI   c                   (     e Zd ZdZdef fdZ xZS )WeaviateEmbeddedInvalidVersionz.Invalid version provided to Weaviate embedded.urlc                 0    d| d}t         |   |       y )Na  Invalid version provided to Weaviate embedded. It must be either:
        - a url to a tar.gz file that contains a Weaviate binary
        - a version number, eg "1.18.2"
        - the string "latest" to download the latest non-beta version

        Url provided was: z
.
        rG   )r   rL   r$   r   s      r   r
   z'WeaviateEmbeddedInvalidVersion.__init__   s*    
 %  	 	r   r   r   s   @r   rK   rK      s    8C  r   rK   N)r   requestsr   r   r"   	Exceptionr   r   r.   r4   r9   r;   r=   r?   rA   rC   rI   rK   r6   r   r   <module>rP      s    *  
 "	 "&)!$5 )!X!'8 !(#4 $5  1 - . >- >$5 ;, ;%6 r   