Where to look-up what exceptions a BOTO3 function can throw?
Almost all exceptions are subclassed from BotoCoreError
. I am not able to find a method to list all exceptions. Look at Botocore Exceptions file to get a list of possible exceptions. I can't find EndpointDisabledException
. Are you using the latest version?
See: Botocore Exceptions
This is how to handle such exceptions:
import boto3
from botocore.exceptions import ClientError
import logging
try:
response = platform_endpoint.publish(
Message=json.dumps(message, ensure_ascii=False),
MessageStructure='json')
logging.info("r = %s" % response)
except ClientError as e:
if e.response['Error']['Code'] == 'EndpointDisabled':
logging.info('EndpointDisabledException thrown')