Where can I see and and in what packages are the exceptions that boto3 throw? for example when using CognitoIdentiy, it has a possibility of throwing a UsernameExistsException(https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminCreateUser.html)
however, the exception does not seem to exists anywhere in the documentation.
The boto3 docs also link to the API docs, it's good to look over both imo:
https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminCreateUser.html
There are definitely improvements that can be made. Can you thumbs up this issue so we can consolidate the tracking: #1262. Closing this in favor of that existing feature request.
Please reopen. The needs of this ticket and #1262 aren't the same. The documentation mentioned in #1262 would be nice but this issue simply asks for the thrown exceptions to be added to the python API docs. I would not think to look in "How to catch boto3 exceptions" to find the specific exception classes thrown by a specific API method call.
But the boto3 exceptions are just listed on the real API docs:
Says see: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminCreateUser.html
Which has a section for errors:
@adamdavis40208 - But they aren't. The "real API docs" list the HTTP errors, not python exception classes.
+1
One simple example I came across lately: Setting the desired capacity of an AutoscalingGroup while another scaling action is in progress.
https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_SetDesiredCapacity.html tells me that a ScalingActivityInProgress-error might happen, but this seems to be the exception that I need to catch:
try:
response = autoscaling_client.set_desired_capacity(
AutoScalingGroupName=asg_name,
DesiredCapacity=asg_min_size,
HonorCooldown=True
)
except autoscaling_client.exceptions.ScalingActivityInProgressFault:
logger.info("Ugh!")
Either I missed the documentation bit or this is left as an exercise to the reader to figure out.
@stealthycoin - This was incorrectly closed. The documentation around this is still unusable.
+1 on this
+1 stack overflow and looking up object.__dict__ isnt ideal
Also, it's not clear if an exception will be in the botocore.exceptions hierarchy or the client.exceptions hierarchy etc., or which exceptions cover other, more specific, exceptions.
Please reopen. I need to be able to find where to import the correct exception classes from.
Most helpful comment
Please reopen. I need to be able to find where to import the correct exception classes from.