Replies: 1 comment 3 replies
-
While this isn't strictly a type-based approach, one way to determine if the returned service error is related to |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there!
I'm trying to write code that assumes a role and then goes on to perform various actions with that role (e.g. read from s3 bucket).
It's pretty similar to the examples shown here:
https://github.com/awslabs/aws-sdk-rust/tree/main/examples/examples/sts/src/bin
Since the user can provide a role that I don't have permissions to assume - I want to catch an "AccessDenied" error and handle it - print something informative to the user about not having permissions.
Unfortunately, after looking at most examples online - I didn't see any way to properly handle it and access the error's code easily. Not by attempting to use
provider.provide_credentials()
which yielsCredentialsError
, nor by callingget_caller_identity()
which yieldsDispatchFailure
.The errors are a huge nested mess, and I honestly didn't understand how to get the access code - ugly code or not.
I'd appreciate any help - thanks a lot! 🙏
Beta Was this translation helpful? Give feedback.
All reactions