File: //lib/python3/dist-packages/awscli/__pycache__/errorhandler.cpython-38.pyc
U
<�^� � @ sV d dl Z e �e�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd � d e�Z dS )
� Nc s e Zd ZdZ� fdd�Z� ZS )�BaseOperationErrorziA {error_type} error ({error_code}) occurred when calling the {operation_name} operation: {error_message}c sF | j j||||d�}tt| ��|� || _|| _|| _|| _|| _ d S )N)�
error_code�
error_message�
error_type�operation_name)
�MSG_TEMPLATE�format�superr �__init__r r r r �http_status_code)�selfr r r r r �msg�� __class__� �5/usr/lib/python3/dist-packages/awscli/errorhandler.pyr
s �zBaseOperationError.__init__)�__name__�
__module__�__qualname__r r
�
__classcell__r r r r r s r c @ s e Zd ZdS )�ClientErrorN�r r r r r r r r $ s r c @ s e Zd ZdS )�ServerErrorNr r r r r r ( s r c @ s e Zd ZdZdd� Zdd� ZdS )�ErrorHandlera�
This class is responsible for handling any HTTP errors that occur
when a service operation is called. It is registered for the
``after-call`` event and will have the opportunity to inspect
all operation calls. If the HTTP response contains an error
``status_code`` an appropriate error message will be printed and
the handler will short-circuit all further processing by exiting
with an appropriate error code.
c K sv t �d|j� d }d }|jdkr*d}t}n|jdks>|jdkrFd}t}|d k rr| �|�\}}|||||j|jd��d S )NzHTTP Response Code: %di� Zserveri� i- Zclient)r r r r r )�LOG�debugZstatus_coder r �_get_error_code_and_message�name) r Z
http_responseZparsedZmodel�kwargsr Zerror_class�code�messager r r �__call__7 s$
�zErrorHandler.__call__c C s8 d}d}d|kr0|d }|� d|�|� d|�fS ||fS )NZUnknown�ErrorZCodeZMessage)�get)r Zresponser r �errorr r r r H s z(ErrorHandler._get_error_code_and_messageN)r r r �__doc__r! r r r r r r , s
r )
ZloggingZ getLoggerr r � Exceptionr r r �objectr r r r r �<module>
s