
                         &    d Z ddlZ G d de      Zy)z,Exceptions used when sending HTTP requests.
    Nc                   8     e Zd ZdZ fdZd Zed        Z xZS )_RequestExceptionz Exception returned by a request.c                     t         t        |           || _        || _        || _        	 t        j                  |      d   d   | _        y # t        $ r Y y t        $ r Y y t        $ r Y y w xY w)Nerrormessage)superr   __init__statuscontentr   jsonloads
ValueErrorKeyError	TypeError)selfr
   r   	__class__s      3lib/third_party/ml_sdk/cloud/ml/util/_exceptions.pyr	   z_RequestException.__init__   sm    	
T+-DKDLDLZZ(1)<dl 
 
 
s    A 	A+A+ A+*A+c                     | j                   S )N)r   )r   s    r   __str__z_RequestException.__str__(   s    <<    c                     	 t        j                  | j                        }|j	                  di       j	                  dd      S # t        $ r Y yw xY w)z<Returns the error code if one is present and None otherwise.Nr   code)r   r   r   r   get)r   parsed_contents     r   
error_codez_RequestException.error_code+   sQ    zz$,,/n gr*..vt<<   s   A 	AA)	__name__
__module____qualname____doc__r	   r   propertyr   __classcell__)r   s   @r   r   r      s$    (" = =r   r   )r   r   	Exceptionr    r   r   <module>r$      s    #=	 #=r   