File: //opt/cppython/lib/python3.8/site-packages/botocore/__pycache__/errorfactory.cpython-38.pyc
U
KD�g� � @ s8 d dl mZ d dlmZ G dd� d�ZG dd� d�ZdS )� )�ClientError)�get_service_module_namec @ s( e Zd ZeZdd� Zdd� Zdd� ZdS )�BaseClientExceptionsc C s
|| _ dS )a Base class for exceptions object on a client
:type code_to_exception: dict
:param code_to_exception: Mapping of error codes (strings) to exception
class that should be raised when encountering a particular
error code.
N)�_code_to_exception)�self�code_to_exception� r �B/opt/cppython/lib/python3.8/site-packages/botocore/errorfactory.py�__init__ s zBaseClientExceptions.__init__c C s | j �|| j�S )aN Retrieves the error class based on the error code
This is helpful for identifying the exception class needing to be
caught based on the ClientError.parsed_reponse['Error']['Code'] value
:type error_code: string
:param error_code: The error code associated to a ClientError exception
:rtype: ClientError or a subclass of ClientError
:returns: The appropriate modeled exception class for that error
code. If the error code does not match any of the known
modeled exceptions then return a generic ClientError.
)r �getr )r �
error_coder r r � from_code s zBaseClientExceptions.from_codec C s6 dd� | j �� D �}t| � d|� dd�|�� ���d S )Nc S s g | ]
}|j �qS r )�__name__)�.0�
exception_clsr r r �
<listcomp>/ s �z4BaseClientExceptions.__getattr__.<locals>.<listcomp>z object has no attribute z. Valid exceptions are: z, )r �values�AttributeError�join)r �nameZexception_cls_namesr r r �__getattr__. s ��z BaseClientExceptions.__getattr__N)r �
__module__�__qualname__r r
r
r r r r r r s
r c @ s$ e Zd Zdd� Zdd� Zdd� ZdS )�ClientExceptionsFactoryc C s
i | _ d S )N)�_client_exceptions_cache)r r r r r
: s z ClientExceptionsFactory.__init__c C s. |j }|| jkr$| �|�}|| j|<