awslabs / iam-roles-anywhere-session

This package provides an easy way to create a refreshable boto3 Session with AWS Roles Anywhere.
https://awslabs.github.io/iam-roles-anywhere-session/
Apache License 2.0
46 stars 7 forks source link

Throw an error when credentials cannot be created #6

Closed tylersmith34 closed 1 year ago

tylersmith34 commented 1 year ago

Issue #, if available: none

Description of changes: Catch when there is an error making credentials and throw an exception instead with a proper message instead of making the user interpret another error message. This is what is thrown when there's any sort of error:

(<class 'TypeError'>, TypeError("'NoneType' object is not subscriptable"), <traceback object at 0x1108e7d00>)

Instead, this will return the error from the AWS API call that providers a human friendly message like Exception: Requested Role isn't one of those listed in the Profile..

I know it's pretty lazy to use the base exception class but there's precedence within this code base for using it, and well, I'm being lazy as I try to make this codebase work for my needs.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.