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

Request Id in Errors #884

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

EngHabu
Copy link

@EngHabu EngHabu commented Jun 17, 2024

Add RequestID and Http Status Code to the error object.

Signed-off-by: Haytham Abuelfutuh <haytham@afutuh.com>
@martindurant
Copy link
Member

This is a reasonable idea, please let me know when you are finished. Note that moto (the CI backend) probably has a different idea of request ID compared to AWS S3, and of course there are several other S3 implementations (e.g., minio) that might have something different again.

@EngHabu
Copy link
Author

EngHabu commented Jun 17, 2024

Thank you for your quick comment, @martindurant.
Looks like moto uses the same s3 response structure for RequestId: https://github.com/getmoto/moto/blob/master/tests/test_s3/test_s3_metadata.py#L20-L25 (added here)

I don't seem to find request ids in minio responses (sad). Not in the body and nor in the response headers.
image
image

Signed-off-by: Haytham Abuelfutuh <haytham@afutuh.com>
@EngHabu EngHabu marked this pull request as ready for review June 18, 2024 13:56
@EngHabu
Copy link
Author

EngHabu commented Jun 18, 2024

@martindurant mind taking a look?

@martindurant
Copy link
Member

This could use a test; any error on moto should have both the status and ID set (non-empty). I wonder whether instead of extending the message, we should add the information to the exception object, so it only shows up for those who want it. What do you think?

Signed-off-by: Haytham Abuelfutuh <haytham@afutuh.com>
@EngHabu
Copy link
Author

EngHabu commented Jun 21, 2024

I briefly looked into that as well because I would like to be able to extract that information separately. But it uses the native OSError type and not sure how you feel about subclassing that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants