
    SIg              	       x   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dS )    Nc                       e Zd ZdS )YouTrackErrorN__name__
__module____qualname__     0./modules/youtrack/youtrack_client/exceptions.pyr   r              Dr
   r   c                   (     e Zd ZdZ fdZd Z xZS )YouTrackRequestErrorNc                 f    || _         t          t          |                               |           d S )N)original_errorsuperr   __init__)selfr   	__class__s     r   r   zYouTrackRequestError.__init__   s0    ,"D))22>BBBBBr
   c                     dg}|                     d t          j        t          | j                  | j                  D                        d                    |          S )Nz"Failed to communicate with server:c              3   @   K   | ]}|                     d           V  dS )
N)rstrip).0lines     r   	<genexpr>z/YouTrackRequestError.__str__.<locals>.<genexpr>   sB       
 
 KK
 
 
 
 
 
r
   r   )extend	tracebackformat_exception_onlytyper   join)r   liness     r   __str__zYouTrackRequestError.__str__   sq    56 
 
!7T())# 
 
 
 	
 	
 	
 yyr
   )r   r   r   r   r   r"   __classcell__r   s   @r   r   r      sQ        NC C C C 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        | _        	 |                                }|                    d          | _        |                    d          | _        n# t          $ r Y nw xY wt          t          |           
                    |           d S )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     #/o	DMMOOE 7++DJ%*YY/B%C%CD""	  	 	 	D	
 	!4((11(;;;;;s   A+ +
A87A8c                 ^    d                     | j        | j        | j        | j                  }|S )Nz({}) {} - {}: {})formatr+   r,   r(   r)   )r   msgs     r   r"   zYouTrackServerError.__str__/   s4     ''KJ"	
 
 
r
   )r   r   r   r*   r+   r,   r(   r)   r   r"   r#   r$   s   @r   r&   r&      sa        HKFE< < < < <      r
   r&   c                        e Zd Z fdZ xZS )OutOfRetriesc                 |    d                     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   s8                r
   r4   c                       e Zd ZdS )
BadRequestNr   r	   r
   r   r7   r7   B   r   r
   r7   c                       e Zd ZdS )UnauthorizedNr   r	   r
   r   r9   r9   F   r   r
   r9   c                       e Zd ZdS )	ForbiddenNr   r	   r
   r   r;   r;   J   r   r
   r;   c                       e Zd ZdS )NotFoundNr   r	   r
   r   r=   r=   N   r   r
   r=   c                       e Zd ZdS )ConflictNr   r	   r
   r   r?   r?   R   r   r
   r?   c                       e Zd ZdS )PreconditionFailedNr   r	   r
   r   rA   rA   V   r   r
   rA   c                       e Zd ZdS )UnprocessableEntityNr   r	   r
   r   rC   rC   Z   r   r
   rC   c                       e Zd ZdS )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
   