o
    ³©iŽ
  ã                   @   s4   d Z ddlmZ G dd„ deƒZG dd„ deƒZdS )z
SDK exception module.
é    )Ú
error_typec                   @   sH   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dS )ÚClientExceptionzclient exceptionc                 C   s"   t  | ¡ tj| _|| _|| _dS )za

        :param code: error code
        :param message: error message
        :return:
        N)Ú	ExceptionÚ__init__r   ÚERROR_TYPE_CLIENTÚ_ClientException__error_typeÚmessageÚ
error_code)ÚselfÚcodeÚmsg© r   úZ/home/ubuntu/.local/lib/python3.10/site-packages/aliyunsdkcore/acs_exception/exceptions.pyr       s   

zClientException.__init__c                 C   s   d| j | jf S )Nz%s %s)r	   r   ©r
   r   r   r   Ú__str__,   s   þzClientException.__str__c                 C   ó
   || _ d S ©N©r	   ©r
   r   r   r   r   Úset_error_code2   ó   
zClientException.set_error_codec                 C   r   r   ©r   ©r
   r   r   r   r   Úset_error_msg5   r   zClientException.set_error_msgc                 C   ó   | j S r   )r   r   r   r   r   Úget_error_type8   ó   zClientException.get_error_typec                 C   r   r   r   r   r   r   r   Úget_error_code;   r   zClientException.get_error_codec                 C   r   r   r   r   r   r   r   Úget_error_msg>   r   zClientException.get_error_msgN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r   r   r   r      s    r   c                   @   sZ   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ ZdS )ÚServerExceptionz
    server exception
    Nc                 C   s.   t  | ¡ || _|| _tj| _|| _|| _d S r   )	r   r   r	   r   r   ÚERROR_TYPE_SERVERÚ_ServerException__error_typeÚhttp_statusÚ
request_id)r
   r   r   r&   r'   r   r   r   r   G   s   

zServerException.__init__c                 C   s   dt | jƒ| j| j| jf S )Nz)HTTP Status: %s Error:%s %s RequestID: %s)Ústrr&   r	   r   r'   r   r   r   r   r   O   s   üzServerException.__str__c                 C   r   r   r   r   r   r   r   r   W   r   zServerException.set_error_codec                 C   r   r   r   r   r   r   r   r   Z   r   zServerException.set_error_msgc                 C   r   r   )r%   r   r   r   r   r   ]   r   zServerException.get_error_typec                 C   r   r   r   r   r   r   r   r   `   r   zServerException.get_error_codec                 C   r   r   r   r   r   r   r   r   c   r   zServerException.get_error_msgc                 C   r   r   )r&   r   r   r   r   Úget_http_statusf   r   zServerException.get_http_statusc                 C   r   r   )r'   r   r   r   r   Úget_request_idi   r   zServerException.get_request_id)NN)r   r    r!   r"   r   r   r   r   r   r   r   r)   r*   r   r   r   r   r#   B   s    
r#   N)r"   Úaliyunsdkcore.acs_exceptionr   r   r   r#   r   r   r   r   Ú<module>   s   %