U
    Zfa                     @   s   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 )c                       s(   e Zd ZdZ fddZdd Z  ZS )DropboxExceptionz8All errors related to making an API request extend this.c                    s"   t t| j|f|| || _d S N)superr   __init__
request_id)selfr   argskwargs	__class__ 6/tmp/pip-unpacked-wheel-qnjxxdf1/dropbox/exceptions.pyr      s    zDropboxException.__init__c                 C   s   t | S r   )reprr   r   r   r   __str__
   s    zDropboxException.__str__)__name__
__module____qualname____doc__r   r   __classcell__r   r   r	   r   r      s   r   c                       s(   e Zd ZdZ fddZdd Z  ZS )ApiErrorz#Errors produced by the Dropbox API.c                    s(   t t| || || _|| _|| _dS )a  
        :param (str) request_id: A request_id can be shared with Dropbox
            Support to pinpoint the exact request that returns an error.
        :param error: An instance of the error data type for the route.
        :param (str) user_message_text: A human-readable message that can be
            displayed to the end user. Is None, if unavailable.
        :param (str) user_message_locale: The locale of ``user_message_text``,
            if present.
        N)r   r   r   erroruser_message_textuser_message_locale)r   r   r   r   r   r	   r   r   r      s    
zApiError.__init__c                 C   s   d | j| jS )NzApiError({!r}, {})formatr   r   r   r   r   r   __repr__    s    zApiError.__repr__r   r   r   r   r   r   r   r   r   r	   r   r      s   r   c                       s(   e Zd ZdZ fddZdd Z  ZS )	HttpErrorz"Errors produced at the HTTP layer.c                    s$   t t| ||| || _|| _d S r   )r   r   r   status_codebody)r   r   r   r   r	   r   r   r   '   s    zHttpError.__init__c                 C   s   d | j| j| jS )NzHttpError({!r}, {}, {!r})r   r   r   r   r   r   r   r   r   ,   s     zHttpError.__repr__r   r   r   r	   r   r   $   s   r   c                       s*   e Zd ZdZd fdd	Zdd Z  ZS )PathRootErrorz%Error caused by an invalid path root.Nc                    s   t t| |dd  || _d S )Ni  )r   r!   r   r   r   r   r   r	   r   r   r   4   s    zPathRootError.__init__c                 C   s   d | j| jS )NzPathRootError({!r}, {!r})r   r   r   r   r   r   8   s    zPathRootError.__repr__)Nr   r   r   r	   r   r!   1   s   r!   c                       s(   e Zd ZdZ fddZdd Z  ZS )BadInputErrorz7Errors due to bad input parameters to an API Operation.c                    s   t t| |d| || _d S )Ni  )r   r#   r   message)r   r   r$   r	   r   r   r   ?   s    zBadInputError.__init__c                 C   s   d | j| jS )NzBadInputError({!r}, {!r}))r   r   r$   r   r   r   r   r   C   s    zBadInputError.__repr__r   r   r   r	   r   r#   <   s   r#   c                       s(   e Zd ZdZ fddZdd Z  ZS )	AuthErrorz1Errors due to invalid authentication credentials.c                    s   t t| |dd  || _d S )Ni  )r   r%   r   r   r"   r	   r   r   r   J   s    zAuthError.__init__c                 C   s   d | j| jS )NzAuthError({!r}, {!r})r   r   r   r   r   r   N   s    zAuthError.__repr__r   r   r   r	   r   r%   G   s   r%   c                       s*   e Zd ZdZd fdd	Zdd Z  ZS )RateLimitErrorzError caused by rate limiting.Nc                    s$   t t| |dd  || _|| _d S )Ni  )r   r&   r   r   backoff)r   r   r   r'   r	   r   r   r   U   s    zRateLimitError.__init__c                 C   s   d | j| j| jS )Nz RateLimitError({!r}, {!r}, {!r}))r   r   r   r'   r   r   r   r   r   Z   s
      zRateLimitError.__repr__)NNr   r   r   r	   r   r&   R   s   r&   c                   @   s   e Zd ZdZdd ZdS )InternalServerErrorz#Errors due to a problem on Dropbox.c                 C   s   d | j| j| jS )Nz#InternalServerError({!r}, {}, {!r})r    r   r   r   r   r   b   s
      zInternalServerError.__repr__N)r   r   r   r   r   r   r   r   r   r(   _   s   r(   N)		Exceptionr   r   r   r!   r#   r%   r&   r(   r   r   r   r   <module>   s   