Created
June 23, 2020 15:43
-
-
Save cheeyeo/33a5c321b81ad5403822e468f7e965ec to your computer and use it in GitHub Desktop.
Creating a boto3 ClientError manually!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raise ClientError(operation_name='InvalidKeyPair.Duplicate', error_response={ | |
'Error': { | |
'Code': 'Duplicate', | |
'Message': 'This is a custom message' | |
} | |
} | |
) |
Thank you, this was really helpful for creating a MagicMock
side effect
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not recommended but rather let the boto3 sdk return the appropriate exceptions
Only use I can think of is you have custom exceptions ...