
                         D    S SK Jr  S SKJr   " S S5      r " S S5      rg)    )ClientError)get_service_module_namec                   *    \ rS rSr\rS rS rS rSrg)BaseClientExceptions   c                     Xl         g)zBase 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_exceptions     (lib/third_party/botocore/errorfactory.py__init__BaseClientExceptions.__init__   s
     #4    c                 L    U R                   R                  XR                  5      $ )a  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_codes     r   	from_codeBaseClientExceptions.from_code   s!     &&**:7G7GHHr   c           	          U R                   R                  5        Vs/ s H  nUR                  PM     nn[        U  SU SSR	                  U5       35      es  snf )Nz object has no attribute z. Valid exceptions are: z, )r
   values__name__AttributeErrorjoin)r   nameexception_clsexception_cls_namess       r   __getattr__ BaseClientExceptions.__getattr__.   st     "&!8!8!?!?!A
!A ""!A 	 
 v.tf 5&&*ii0C&D%EG
 	
	
s   Ar	   N)	r   
__module____qualname____firstlineno__r   r   r   r   __static_attributes__ r   r   r   r      s    K4I 
r   r   c                   &    \ rS rSrS rS rS rSrg)ClientExceptionsFactory9   c                     0 U l         g )N_client_exceptions_cache)r   s    r   r    ClientExceptionsFactory.__init__:   s
    (*%r   c                     UR                   nX R                  ;  a  U R                  U5      nX0R                  U'   U R                  U   $ )aZ  Creates a ClientExceptions object for the particular service client

:type service_model: botocore.model.ServiceModel
:param service_model: The service model for the client

:rtype: object that subclasses from BaseClientExceptions
:returns: The exceptions object of a client that can be used
    to grab the various different modeled exceptions.
)service_namer*   _create_client_exceptions)r   service_modelr-   client_exceptionss       r   create_client_exceptions0ClientExceptionsFactory.create_client_exceptions=   sK     %11<<< $ > >} M:K)),7,,\::r   c                    0 n0 nUR                    HG  n[        UR                  5      n[        U[        40 5      nXbU'   [        UR
                  5      nXcU'   MI     [        [        U5      S-   5      n[        U[        4U5      n	U	" U5      $ )N
Exceptions)error_shapesstrr   typer   r   r   r   )
r   r/   	cls_propsr   error_shapeexception_namer   codecls_nameclient_exceptions_clss
             r   r.   1ClientExceptionsFactory._create_client_exceptionsM   s    	(55K !1!12N +DM(5n%{--.D&3d# 6 .}=LM $+-y!
 %%677r   r)   N)r   r    r!   r"   r   r1   r.   r#   r$   r   r   r&   r&   9   s    +; 8r   r&   N)botocore.exceptionsr   botocore.utilsr   r   r&   r$   r   r   <module>rA      s"    , 2%
 %
P!8 !8r   