
    4Rj                       d dl mZ d dlmZmZ d dlmZ d dlZddlm	Z	 ddl
mZ g d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 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/ d0e      Z!y)1    )annotations)Unioncast)LiteralN   )is_dict)	ErrorType)BadRequestErrorAuthenticationErrorPermissionDeniedErrorNotFoundErrorConflictErrorUnprocessableEntityErrorRateLimitErrorInternalServerErrorc                      e Zd Zy)AnthropicErrorN__name__
__module____qualname__     ]/var/www/html/meridian/meridian-ai/venv/lib/python3.12/site-packages/anthropic/_exceptions.pyr   r          r   r   c                  B     e Zd ZU ded<   ded<   ded<   	 d fdZ xZS )	APIErrorstrmessagehttpx.Requestrequestobject | Nonebodyc               N    t         |   |       || _        || _        || _        y )N)super__init__r!   r   r#   )selfr   r!   r#   	__class__s       r   r&   zAPIError.__init__,   s%    !	r   )r   r   r!   r    r#   r"   returnNoner   r   r   __annotations__r&   __classcell__r(   s   @r   r   r      s#    L
 r   r   c                  <     e Zd ZU ded<   ded<   ddd fdZ xZS )	APIResponseValidationErrorhttpx.Responseresponseintstatus_codeNr   c               v    t         |   |xs d|j                  |       || _        |j                  | _        y )Nz1Data returned by API invalid for expected schema.r#   )r%   r&   r!   r2   r4   )r'   r2   r#   r   r(   s       r   r&   z#APIResponseValidationError.__init__7   s:    W$WYaYiYiptu #//r   )r2   r1   r#   r"   r   
str | Noner)   r*   r+   r.   s   @r   r0   r0   3   s    _c 0 0r   r0   c                      e Zd Zy)APIWebhookValidationErrorNr   r   r   r   r:   r:   =   r   r   r:   c                  N     e Zd ZU dZded<   ded<   ded<   ded	<   d fd
Z xZS )APIStatusErrorz<Raised when an API response has a status code of 4xx or 5xx.r1   r2   r3   r4   r8   
request_idzErrorType | Nonetypec               h   t         |   ||j                  |       || _        |j                  | _        |j
                  j                  d      | _        d | _        t        |      rK|j                  d      }t        |      r.t        t        t        d f   |j                  d            | _        y y y )Nr7   z
request-iderrorr>   )r%   r&   r!   r2   r4   headersgetr=   r>   r   r   r   r	   )r'   r   r2   r#   r@   r(   s        r   r&   zAPIStatusError.__init__I   s    ("2"2> #//"**..|<	4=HHW%Eu~ y$!769JK	  r   )r   r   r2   r1   r#   r"   r)   r*   )r   r   r   __doc__r,   r&   r-   r.   s   @r   r<   r<   A   s*    F

L 
Lr   r<   c                  &     e Zd Zddd fdZ xZS )APIConnectionErrorzConnection error.r5   c               *    t         |   ||d        y )Nr7   r%   r&   )r'   r   r!   r(   s      r   r&   zAPIConnectionError.__init__W   s    '5r   )r   r   r!   r    r)   r*   r   r   r   r&   r-   r.   s   @r   rE   rE   V   s    )< 6 6r   rE   c                        e Zd Zd fdZ xZS )APITimeoutErrorc                (    t         |   d|       y )NzRequest timed out or interrupted. This could be due to a network timeout, dropped connection, or request cancellation. See https://docs.anthropic.com/en/api/errors#long-requests for more details.)r   r!   rG   )r'   r!   r(   s     r   r&   zAPITimeoutError.__init__\   s     Z 	 	
r   )r!   r    r)   r*   rH   r.   s   @r   rJ   rJ   [   s    
 
r   rJ   c                      e Zd ZdZy)RetryableErrora  An error that opts into the SDK's retry policy: raise it (e.g. from
    middleware) to have the request attempt retried.

    The request is only retried while `max_retries` has not been exhausted;
    once exhausted the error propagates to the caller as-is.
    N)r   r   r   rC   r   r   r   rM   rM   c   s    r   rM   c                      e Zd ZU dZded<   y)r
   i  zLiteral[400]r4   Nr   r   r   r4   r,   r   r   r   r
   r
   l        #K#r   r
   c                      e Zd ZU dZded<   y)r   i  zLiteral[401]r4   NrO   r   r   r   r   r   p   rP   r   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[403]r4   NrO   r   r   r   r   r   t   rP   r   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[404]r4   NrO   r   r   r   r   r   x   rP   r   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[409]r4   NrO   r   r   r   r   r   |   rP   r   r   c                      e Zd ZU dZded<   y)RequestTooLargeErrori  zLiteral[413]r4   NrO   r   r   r   rV   rV      rP   r   rV   c                      e Zd ZU dZded<   y)r   i  zLiteral[422]r4   NrO   r   r   r   r   r      rP   r   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[429]r4   NrO   r   r   r   r   r      rP   r   r   c                      e Zd ZU dZded<   y)ServiceUnavailableErrori  zLiteral[503]r4   NrO   r   r   r   rZ   rZ      rP   r   rZ   c                      e Zd ZU dZded<   y)OverloadedErrori  zLiteral[529]r4   NrO   r   r   r   r\   r\      rP   r   r\   c                      e Zd ZU dZded<   y)DeadlineExceededErrori  zLiteral[504]r4   NrO   r   r   r   r^   r^      rP   r   r^   c                      e Zd Zy)r   Nr   r   r   r   r   r      r   r   r   )"
__future__r   typingr   r   typing_extensionsr   httpx_utilsr   types.shared.error_typer	   __all__	Exceptionr   r   r0   r:   r<   rE   rJ   rM   r
   r   r   r   r   rV   r   r   rZ   r\   r^   r   r   r   r   <module>rh      s   #  %   .		Y 	~ ,0 0	 	LX L*6 6

( 
^ $n $$. $$N $$N $$N $$> $$~ $$^ $$n $$n $$N $	. 	r   