Same exception for different use case - boto3
up vote
0
down vote
favorite
Using boto3 IAM, i am trying to deactivate MFA device attached to a specified user. I came across few exceptions which i need to handle.
I am passing the UserName during runtime.
1- passing already disabled UserName during runtime
python mfa.py John
botocore.errorfactory.NoSuchEntityException: An error occurred (NoSuchEntity) when calling the DeactivateMFADevice operation: MFA Device invalid for user.
2. Passed incorrect UserName
python mfa.py John.d
botocore.errorfactory.NoSuchEntityException: An error occurred (NoSuchEntity) when calling the DeactivateMFADevice operation: The user with name John.d cannot be found.
How to handle both error, since both exceptions are a part of
botocore.errorfactory.NoSuchEntityException
How can i handle the both in different exceptions so that i can
print("MFA is already disabled")
OR
print("Invalid UserName")
amazon-web-services boto3 botocore
add a comment |
up vote
0
down vote
favorite
Using boto3 IAM, i am trying to deactivate MFA device attached to a specified user. I came across few exceptions which i need to handle.
I am passing the UserName during runtime.
1- passing already disabled UserName during runtime
python mfa.py John
botocore.errorfactory.NoSuchEntityException: An error occurred (NoSuchEntity) when calling the DeactivateMFADevice operation: MFA Device invalid for user.
2. Passed incorrect UserName
python mfa.py John.d
botocore.errorfactory.NoSuchEntityException: An error occurred (NoSuchEntity) when calling the DeactivateMFADevice operation: The user with name John.d cannot be found.
How to handle both error, since both exceptions are a part of
botocore.errorfactory.NoSuchEntityException
How can i handle the both in different exceptions so that i can
print("MFA is already disabled")
OR
print("Invalid UserName")
amazon-web-services boto3 botocore
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Using boto3 IAM, i am trying to deactivate MFA device attached to a specified user. I came across few exceptions which i need to handle.
I am passing the UserName during runtime.
1- passing already disabled UserName during runtime
python mfa.py John
botocore.errorfactory.NoSuchEntityException: An error occurred (NoSuchEntity) when calling the DeactivateMFADevice operation: MFA Device invalid for user.
2. Passed incorrect UserName
python mfa.py John.d
botocore.errorfactory.NoSuchEntityException: An error occurred (NoSuchEntity) when calling the DeactivateMFADevice operation: The user with name John.d cannot be found.
How to handle both error, since both exceptions are a part of
botocore.errorfactory.NoSuchEntityException
How can i handle the both in different exceptions so that i can
print("MFA is already disabled")
OR
print("Invalid UserName")
amazon-web-services boto3 botocore
Using boto3 IAM, i am trying to deactivate MFA device attached to a specified user. I came across few exceptions which i need to handle.
I am passing the UserName during runtime.
1- passing already disabled UserName during runtime
python mfa.py John
botocore.errorfactory.NoSuchEntityException: An error occurred (NoSuchEntity) when calling the DeactivateMFADevice operation: MFA Device invalid for user.
2. Passed incorrect UserName
python mfa.py John.d
botocore.errorfactory.NoSuchEntityException: An error occurred (NoSuchEntity) when calling the DeactivateMFADevice operation: The user with name John.d cannot be found.
How to handle both error, since both exceptions are a part of
botocore.errorfactory.NoSuchEntityException
How can i handle the both in different exceptions so that i can
print("MFA is already disabled")
OR
print("Invalid UserName")
amazon-web-services boto3 botocore
amazon-web-services boto3 botocore
edited yesterday
asked yesterday
Ebin Davis
333139
333139
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53215680%2fsame-exception-for-different-use-case-boto3%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password