ó
 KMc           @   s}  d  Z  e Z d d d d d d d d d	 d
 d d d d g Z d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ	 d e f d „  ƒ  YZ
 d e
 f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d	 e f d „  ƒ  YZ d e
 f d „  ƒ  YZ d „  Z d S(   s   lazr.restfulclient errors.t
   BadRequestt   Conflictt   ClientErrort   CredentialsErrort   CredentialsFileErrort	   HTTPErrort   MethodNotAllowedt   NotFoundt   PreconditionFailedt   RestfulErrort   ResponseErrort   ServerErrort   Unauthorizedt   UnexpectedResponseErrorc           B   s   e  Z d  Z RS(   s2   Base error for the lazr.restfulclient API library.(   t   __name__t
   __module__t   __doc__(    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR	   (   s   c           B   s   e  Z d  Z RS(   s&   Base credentials/authentication error.(   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   ,   s   c           B   s   e  Z d  Z RS(   s   Error in credentials file.(   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   0   s   c           B   s   e  Z d  Z d „  Z RS(   s   Error in response.c         C   s#   t  j |  ƒ | |  _ | |  _ d  S(   N(   R	   t   __init__t   responset   content(   t   selfR   R   (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   7   s    	(   R   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR
   4   s   c           B   s   e  Z d  Z d „  Z RS(   s$   An unexpected response was received.c         C   s   d |  j  j |  j  j f S(   Ns   %s: %s(   R   t   statust   reason(   R   (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyt   __str__@   s    (   R   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   =   s   c           B   s   e  Z d  Z d „  Z RS(   s+   An HTTP non-2xx response code was received.c         C   sX   d j  g  t |  j j ƒ  ƒ D] } d | ^ q ƒ } d |  j j |  j j | |  j f S(   s9   Show the error code, response headers, and response body.s   
s   %s: %ssI   HTTP Error %s: %s
Response headers:
---
%s
---
Response body:
---
%s
---
(   t   joint   sortedR   t   itemsR   R   R   (   R   t   pairt   headers(    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   G   s    	,(   R   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   D   s   c           B   s   e  Z d  Z RS(   s.   An exception representing a client-side error.(   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   Q   s   c           B   s   e  Z d  Z RS(   s4   An exception representing an authentication failure.(   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   U   s   c           B   s   e  Z d  Z RS(   s1   An exception representing a nonexistent resource.(   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   Y   s   c           B   s   e  Z d  Z RS(   sœ   An exception raised when you use an unsupported HTTP method.

    This is most likely because you tried to delete a resource that
    can't be deleted.
    (   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   ]   s   c           B   s   e  Z d  Z RS(   s:   An exception representing a problem with a client request.(   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR    e   s   c           B   s   e  Z d  Z RS(   s9   An exception representing a conflict with another client.(   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   i   s   c           B   s   e  Z d  Z RS(   së   An exception representing the failure of a conditional PUT/PATCH.

    The most likely explanation is that another client changed this
    object while you were working on it, and your version of the
    object is now out of date.
    (   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   m   s   c           B   s   e  Z d  Z RS(   s.   An exception representing a server-side error.(   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyR   u   s   c         C   s°   i t  d 6t d 6t d 6t d 6t d 6t d 6} |  j d d k rG d S| j |  j t	 ƒ } | t	 k r£ |  j d d	 k r„ t
 } q£ |  j d d
 k r£ t } q£ n  | |  | ƒ S(   sä   Turn an HTTP response into an HTTPError subclass.

    :return: None if the response code is 1xx, 2xx or 3xx. Otherwise,
    an instance of an appropriate HTTPError subclass (or HTTPError
    if nothing else is appropriate.
    i  i‘  i”  i•  i™  iœ  id   i   i   i   N(   R    R   R   R   R   R   R   t   Nonet   getR   R   R   (   R   R   t   http_errors_by_status_codet   cls(    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyt	   error_fory   s     
	N(   R   t   typet   __metaclass__t   __all__t	   ExceptionR	   R   R   R
   R   R   R   R   R   R   R    R   R   R   R!   (    (    (    s=   /usr/lib/python2.7/dist-packages/lazr/restfulclient/errors.pyt   <module>   s<   		