o ?c@s8ddlmZddlmZGdddZGdddZdS)) ClientError)get_service_module_namec@s(eZdZeZddZddZddZdS)BaseClientExceptionscCs ||_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)selfcode_to_exceptionrp/private/var/folders/cw/wlscbxl13mj6wd668h7l9g9sllkg5j/T/pip-target-b31awkwq/lib/python/botocore/errorfactory.py__init__s zBaseClientExceptions.__init__cCs|j||jS)aNRetrieves 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. )rgetr)r error_coderrr from_codeszBaseClientExceptions.from_codecCs2dd|jD}t|d|dd|)NcSsg|]}|jqSr)__name__).0 exception_clsrrr /sz4BaseClientExceptions.__getattr__..z object has no attribute z. Valid exceptions are: z, )rvaluesAttributeErrorjoin)rnameZexception_cls_namesrrr __getattr__.s z BaseClientExceptions.__getattr__N)r __module__ __qualname__rr r rrrrr rs  rc@s$eZdZddZddZddZdS)ClientExceptionsFactorycCs i|_dS)N)_client_exceptions_cache)rrrr r :s z ClientExceptionsFactory.__init__cCs.|j}||jvr||}||j|<|j|S)aCreates 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_modelrZclient_exceptionsrrr create_client_exceptions=s     z0ClientExceptionsFactory.create_client_exceptionsc Csli}i}|jD]}t|j}t|tfi}|||<t|j}|||<qtt|d}t|tf|} | |S)NZ Exceptions)Z error_shapesstrrtyperr rr) rrZ cls_propsrZ error_shapeexception_namercodecls_nameZclient_exceptions_clsrrr rMs    z1ClientExceptionsFactory._create_client_exceptionsN)rrrr rrrrrr r9s rN)Zbotocore.exceptionsrZbotocore.utilsrrrrrrr s (