a
    ù!f÷  ã                   @   s˜   d Z G dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG d	d
„ d
eƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZ	G dd„ deƒZ
dS )z*Exceptions for generated client libraries.c                   @   s   e Zd ZdZdS )ÚErrorzBase class for all exceptions.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   ú\/var/www/html/python-backend/venv/lib/python3.9/site-packages/gcloud/streaming/exceptions.pyr      s   r   c                   @   s   e Zd ZdZdS )ÚCommunicationErrorz1Any communication error talking to an API server.Nr   r   r   r   r   r	      s   r	   c                       s@   e Zd ZdZ‡ fdd„Zdd„ Zedd„ ƒZedd	„ ƒZ	‡  Z
S )
Ú	HttpErroraG  Error making a request. Soon to be HttpError.

    :type response: dict
    :param response: headers from the response which returned the error

    :type content: bytes
    :param content: payload of the response which returned the error

    :type url: string
    :param url: URL of the response which returned the error
    c                    s$   t t| ƒ ¡  || _|| _|| _d S ©N)Úsuperr
   Ú__init__ÚresponseÚcontentÚurl)Úselfr   r   r   ©Ú	__class__r   r   r   &   s    zHttpError.__init__c                 C   s    | j  dd¡}d| j| j|f S )NÚasciiÚreplacez6HttpError accessing <%s>: response: <%s>, content <%s>)r   Údecoder   r   )r   r   r   r   r   Ú__str__,   s    
ÿzHttpError.__str__c                 C   s   t | jd ƒS )zZStatus code for the response.

        :rtype: integer
        :returns: the code
        Ústatus)Úintr   )r   r   r   r   Ústatus_code1   s    zHttpError.status_codec                 C   s   | |j |j|jƒS )a'  Factory:  construct an exception from a response.

        :type http_response: :class:`gcloud.streaming.http_wrapper.Response`
        :param http_response: the response which returned the error

        :rtype: :class:`HttpError`
        :returns: The error created from the response.
        )Úinfor   Úrequest_url©ÚclsÚhttp_responser   r   r   Úfrom_response:   s    

ÿzHttpError.from_response)r   r   r   r   r   r   Úpropertyr   Úclassmethodr    Ú__classcell__r   r   r   r   r
      s   
r
   c                   @   s   e Zd ZdZdS )ÚTransferErrorzErrors related to transfers.Nr   r   r   r   r   r$   H   s   r$   c                   @   s   e Zd ZdZdS )ÚTransferRetryErrorz&Retryable errors related to transfers.Nr   r   r   r   r   r%   L   s   r%   c                   @   s   e Zd ZdZdS )ÚTransferInvalidErrorzThe given transfer is invalid.Nr   r   r   r   r   r&   P   s   r&   c                   @   s   e Zd ZdZdS )ÚRequestErrorzThe request was not successful.Nr   r   r   r   r   r'   T   s   r'   c                       s,   e Zd ZdZ‡ fdd„Zedd„ ƒZ‡  ZS )ÚRetryAfterErroraž  The response contained a retry-after header.

    :type response: dict
    :param response: headers from the response which returned the error

    :type content: bytes
    :param content: payload of the response which returned the error

    :type url: string
    :param url: URL of the response which returned the error

    :type retry_after: integer
    :param retry_after: seconds to wait before retrying
    c                    s"   t t| ƒ |||¡ t|ƒ| _d S r   )r   r(   r   r   Úretry_after)r   r   r   r   r)   r   r   r   r   g   s    zRetryAfterError.__init__c                 C   s   | |j |j|j|jƒS )a-  Factory:  construct an exception from a response.

        :type http_response: :class:`gcloud.streaming.http_wrapper.Response`
        :param http_response: the response which returned the error

        :rtype: :class:`RetryAfterError`
        :returns: The error created from the response.
        )r   r   r   r)   r   r   r   r   r    k   s    

ÿzRetryAfterError.from_response)r   r   r   r   r   r"   r    r#   r   r   r   r   r(   X   s   r(   c                   @   s   e Zd ZdZdS )ÚBadStatusCodeErrorz5The request completed but returned a bad status code.Nr   r   r   r   r   r*   y   s   r*   N)r   Ú	Exceptionr   r	   r
   r$   r%   r&   r'   r(   r*   r   r   r   r   Ú<module>   s   .!