
    g              	       .   d dl Z  G d de      Z G d de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eee	e
eeeedZy)    Nc                       e Zd Zy)YouTrackErrorN__name__
__module____qualname__     0./modules/youtrack/youtrack_client/exceptions.pyr   r          r
   r   c                   (     e Zd ZdZ fdZd Z xZS )YouTrackRequestErrorNc                 :    || _         t        t        |   |       y )N)original_errorsuperr   __init__)selfr   	__class__s     r   r   zYouTrackRequestError.__init__   s    ,"D2>Br
   c                     dg}|j                  d t        j                  t        | j                        | j                        D               dj                  |      S )Nz"Failed to communicate with server:c              3   >   K   | ]  }|j                  d         yw)
N)rstrip).0lines     r   	<genexpr>z/YouTrackRequestError.__str__.<locals>.<genexpr>   s!      
 KK
s   r   )extend	tracebackformat_exception_onlytyper   join)r   liness     r   __str__zYouTrackRequestError.__str__   sV    56 
!77T(()##
 	
 yyr
   )r   r   r   r   r   r"   __classcell__r   s   @r   r   r      s    NC	 r
   r   c                   8     e Zd ZdZdZdZdZdZ fdZd Z	 xZ
S )YouTrackServerErrorNc                    || _         |j                  | _        |j                  | _        	 |j                         }|j	                  d      | _        |j	                  d      | _        t        t        | +  |       y # t        $ r Y w xY w)Nerrorerror_description)responsestatus_codereasonjsongetr(   r)   	Exceptionr   r&   r   )r   r*   r(   r   s      r   r   zYouTrackServerError.__init__"   s|     #//oo	DMMOE 7+DJ%*YY/B%CD"!41(;  		s   A< <	BBc                 ~    dj                  | j                  | j                  | j                  | j                        }|S )Nz({}) {} - {}: {})formatr+   r,   r(   r)   )r   msgs     r   r"   zYouTrackServerError.__str__/   s9     ''KKJJ""	
 
r
   )r   r   r   r*   r+   r,   r(   r)   r   r"   r#   r$   s   @r   r&   r&      s'    HKFE<r
   r&   c                        e Zd Z fdZ xZS )OutOfRetriesc                 J    dj                  dt        t        |          f      S )Nr   zOut of retries, last error was:)r    r   r4   r"   )r   r   s    r   r"   zOutOfRetries.__str__;   s)    yy-,-/
  	r
   )r   r   r   r"   r#   r$   s   @r   r4   r4   9   s     r
   r4   c                       e Zd Zy)
BadRequestNr   r	   r
   r   r7   r7   B   r   r
   r7   c                       e Zd Zy)UnauthorizedNr   r	   r
   r   r9   r9   F   r   r
   r9   c                       e Zd Zy)	ForbiddenNr   r	   r
   r   r;   r;   J   r   r
   r;   c                       e Zd Zy)NotFoundNr   r	   r
   r   r=   r=   N   r   r
   r=   c                       e Zd Zy)ConflictNr   r	   r
   r   r?   r?   R   r   r
   r?   c                       e Zd Zy)PreconditionFailedNr   r	   r
   r   rA   rA   V   r   r
   rA   c                       e Zd Zy)UnprocessableEntityNr   r	   r
   r   rC   rC   Z   r   r
   rC   c                       e Zd Zy)PreconditionRequiredNr   r	   r
   r   rE   rE   ^   r   r
   rE   )i  i  i  i  i  i  i  i  )r   r/   r   IOErrorr   r&   r4   r7   r9   r;   r=   r?   rA   rC   rE   STATUS_CODESr	   r
   r   <module>rH      s    	I 	 ='  &- <& 	$ 		& 		# 		" 		" 		, 		- 		. 	
 
								r
   