
                            d Z  G d de      Z G d de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e
eeeedZ G d de      Z G d de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 d0 d1e      Z G d2 d3e	      Z G d4 d5e	      Z G d6 d7e      Z G d8 d9e      Zy:);z*Exceptions for generated client libraries.c                       e Zd ZdZy)ErrorzBase class for all exceptions.N__name__
__module____qualname____doc__     .lib/third_party/apitools/base/py/exceptions.pyr   r          (r
   r   c                       e Zd ZdZy)TypecheckErrorz+An object of an incorrect type is provided.Nr   r	   r
   r   r   r          5r
   r   c                       e Zd ZdZy)NotFoundErrorz(A specified resource could not be found.Nr   r	   r
   r   r   r      s    2r
   r   c                       e Zd ZdZy)	UserErrorz,Base class for errors related to user input.Nr   r	   r
   r   r   r   #   s    6r
   r   c                       e Zd ZdZy)InvalidDataErrorz&Base class for any invalid data error.Nr   r	   r
   r   r   r   (       0r
   r   c                       e Zd ZdZy)CommunicationErrorz1Any communication error talking to an API server.Nr   r	   r
   r   r   r   -   s    ;r
   r   c                   \     e Zd ZdZ	 d fd	Zd Zed        Zed        Z	e
d        Z xZS )	HttpErrorz-Error making a request. Soon to be HttpError.c                     t         j                  |||      }t        t         |   |       || _        || _        || _        || _        || _        y N)	r   _build_messagesuper__init__responsecontenturlmethod_configrequest)selfr    r!   r"   r#   r$   error_message	__class__s          r   r   zHttpError.__init__6   sJ    !007CHi'6 *r
   c                 l    t         j                  | j                  | j                  | j                        S r   )r   r   r    r!   r"   r%   s    r   __str__zHttpError.__str__@   s#    ''t||TXXNNr
   c                 ^    t        |t              r|j                  dd      }d|d| d|dS )NasciireplacezHttpError accessing <z>: response: <z>, content <>)
isinstancebytesdecode)r    r!   r"   s      r   r   zHttpError._build_messageC   s.    gu%nnWi8G7$ 	$r
   c                 2    t        | j                  d         S Nstatus)intr    r)   s    r   status_codezHttpError.status_codeJ   s     4==*++r
   c                     	 t        |j                  j                  d            }t        j                  ||       } ||j                  |j
                  |j                  fi |S # t        $ r | }Y 6w xY wr3   )r5   infoget_HTTP_ERRORS
ValueErrorr!   request_url)clshttp_responsekwargsr6   	error_clss        r   FromResponsezHttpError.FromResponseP   sz    	m0044X>?K$((c:I ++]-B-B&22>6<> 	>  	I	s   :A% %A32A3)NN)r   r   r   r   r   r*   staticmethodr   propertyr6   classmethodrA   __classcell__r'   s   @r   r   r   2   sR    7 .2O $ $ , ,
 > >r
   r   c                       e Zd ZdZy)HttpBadRequestErrorzHTTP 400 Bad Request.Nr   r	   r
   r   rH   rH   [   s    r
   rH   c                       e Zd ZdZy)HttpUnauthorizedErrorzHTTP 401 Unauthorized.Nr   r	   r
   r   rJ   rJ   _   s     r
   rJ   c                       e Zd ZdZy)HttpForbiddenErrorzHTTP 403 Forbidden.Nr   r	   r
   r   rL   rL   c       r
   rL   c                       e Zd ZdZy)HttpNotFoundErrorzHTTP 404 Not Found.Nr   r	   r
   r   rO   rO   g   rM   r
   rO   c                       e Zd ZdZy)HttpConflictErrorzHTTP 409 Conflict.Nr   r	   r
   r   rQ   rQ   k   s    r
   rQ   )i  i  i  i  i  c                       e Zd ZdZy)InvalidUserInputErrorzUser-provided input is invalid.Nr   r	   r
   r   rS   rS   x       )r
   rS   c                       e Zd ZdZy)InvalidDataFromServerErrorz+Data received from the server is malformed.Nr   r	   r
   r   rV   rV   }   r   r
   rV   c                       e Zd ZdZy)
BatchErrorz3Error generated while constructing a batch request.Nr   r	   r
   r   rX   rX      s    =r
   rX   c                       e Zd ZdZy)ConfigurationErrorz$Base class for configuration errors.Nr   r	   r
   r   rZ   rZ      s    .r
   rZ   c                       e Zd ZdZy)GeneratedClientErrorz.The generated client configuration is invalid.Nr   r	   r
   r   r\   r\      s    8r
   r\   c                       e Zd ZdZy)ConfigurationValueErrorz@Some part of the user-specified client configuration is invalid.Nr   r	   r
   r   r^   r^      s    Jr
   r^   c                       e Zd ZdZy)ResourceUnavailableErrorz'User requested an unavailable resource.Nr   r	   r
   r   r`   r`      s    1r
   r`   c                       e Zd ZdZy)CredentialsErrorz&Errors related to invalid credentials.Nr   r	   r
   r   rb   rb      r   r
   rb   c                       e Zd ZdZy)TransferErrorzErrors related to transfers.Nr   r	   r
   r   rd   rd      s    &r
   rd   c                       e Zd ZdZy)TransferRetryErrorz&Retryable errors related to transfers.Nr   r	   r
   r   rf   rf      r   r
   rf   c                       e Zd ZdZy)TransferInvalidErrorzThe given transfer is invalid.Nr   r	   r
   r   rh   rh      r   r
   rh   c                       e Zd ZdZy)RequestErrorzThe request was not successful.Nr   r	   r
   r   rj   rj      rT   r
   rj   c                   2     e Zd ZdZ fdZed        Z xZS )RetryAfterErrorz,The response contained a retry-after header.c                 R    t        t        | 
  |||fi | t        |      | _        y r   )r   rl   r   r5   retry_after)r%   r    r!   r"   rn   r?   r'   s         r   r   zRetryAfterError.__init__   s(    ot-hOO{+r
   c                 j     | |j                   |j                  |j                  |j                  fi |S r   )r8   r!   r<   rn   )r=   r>   r?   s      r   rA   zRetryAfterError.FromResponse   s8    =%%}'<'< ,,m.G.G 	r
   )r   r   r   r   r   rD   rA   rE   rF   s   @r   rl   rl      s    6,  r
   rl   c                       e Zd ZdZy)BadStatusCodeErrorz5The request completed but returned a bad status code.Nr   r	   r
   r   rq   rq      s    ?r
   rq   c                       e Zd ZdZy)NotYetImplementedErrorz*This functionality is not yet implemented.Nr   r	   r
   r   rs   rs      s    4r
   rs   c                       e Zd ZdZy)StreamExhaustedz?Attempted to read more bytes from a stream than were available.Nr   r	   r
   r   ru   ru      s    Ir
   ru   N) r   	Exceptionr   	TypeErrorr   r   r   r   r   r   rH   rJ   rL   rO   rQ   r:   rS   rV   rX   rZ   r\   r^   r`   rb   rd   rf   rh   rj   rl   rq   rs   ru   r	   r
   r   <module>rx      s  " 1)I )
6UI 6
3E 3
7 7
1u 1
< <
&>" &>R )  !I ! 	 	 
 
				*, *
6!13E 6
> >
/ /
95 9
Ki K
2u 2
1u 1
'& '
1 1
)= )
*% *
i @ @
51 5
Je Jr
   