Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include ClientError information in S3UploadFailedError #1986

Closed
mikenolt opened this issue May 30, 2019 · 9 comments
Closed

Include ClientError information in S3UploadFailedError #1986

mikenolt opened this issue May 30, 2019 · 9 comments
Assignees
Labels
auto-label-exempt Issue will not be subject to stale-bot closed-for-staleness feature-request This issue requests a feature. s3

Comments

@mikenolt
Copy link

First issue post so please bear with me.

I am using boto3 (1.9.141) and python 3.7.

When I have invalid keys, I want to trap the response and see if ClientError.response['Error']['Code] is 'InvalidAccessKeyId'. This works great for most of the calls (list_buckets, list_objects, head_object, etc.)

However, when I use upload_file with invalid keys, it raises S3UploadFailedErrror and the only thing in it (that I can tell - I looked at the boto3.s3.transfer code) is a custom message that is created from ClientError ['Code'] and ['Message'] - is something along the lines of - "Failed to upload {file} to {location}: An error occurred (InvalidAccessKeyId) when calling the CreateMultipartUpload operation....."

I'm not sure why a new error was created instead of using ClientError but if you are going to continue to use S3UploadFailedError, can you make it so we can get fields (Error-Code and Error-Message) from it like ClientError instead of just a generic string that I have to manually parse?

Thanks,
Mike

@mikenolt
Copy link
Author

mikenolt commented Jun 2, 2019

Does anyone have any thoughts on this? Is anyone going to look at it?

@swetashre swetashre self-assigned this Jun 2, 2019
@swetashre
Copy link
Contributor

@mikenolt - Thank you for your post. Sorry for the late reply. I am looking into it.

@mikenolt
Copy link
Author

mikenolt commented Jun 4, 2019

Great, thank you for letting me know @swetashre! Please let me know if you have any questions or need anything from me.

@swetashre
Copy link
Contributor

@mikenolt - Thank you for your reply. I would mark this as feature request.

@swetashre swetashre added s3 feature-request This issue requests a feature. labels Jun 4, 2019
@mikenolt
Copy link
Author

mikenolt commented Jun 4, 2019

Okay @swetashre. I think it's a bug since it's not consistent with the other error implementations and the user can't easily get the error code or message but understand it technically isn't a bug.

Thanks for looking at it.

Can I interest you in looking at issue #1987? That does seem like a bug.

Mike

@swetashre
Copy link
Contributor

@mikenolt - Thanks for the feedback. I will look into that.

@swetashre swetashre added the auto-label-exempt Issue will not be subject to stale-bot label Aug 18, 2020
@Zerogoki00
Copy link

@mikenolt
possible workaround is using s3transfer.manager.TransferManager directly. It will raise only ClientError exceptions.

@swetashre swetashre assigned kdaily and unassigned swetashre Mar 25, 2021
@github-actions
Copy link

Greetings! It looks like this issue hasn’t been active in longer than one year. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Mar 25, 2022
@glerb
Copy link
Contributor

glerb commented Oct 11, 2024

Definitely still an issue 5+ years later. My first foray into boto error handling has been with S3, so you can imagine my surprise when this happened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-label-exempt Issue will not be subject to stale-bot closed-for-staleness feature-request This issue requests a feature. s3
Projects
None yet
Development

No branches or pull requests

5 participants