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

Create session error code #392

Merged
merged 7 commits into from
Dec 7, 2023
Merged

Create session error code #392

merged 7 commits into from
Dec 7, 2023

Conversation

TingDaoK
Copy link
Contributor

@TingDaoK TingDaoK commented Dec 6, 2023

Issue #, if available:

  • If the CreateSession failed, the error code we report is the same as a meta request failure, however the CreateSession http response was not reported from the finished callback, as it's not really part of the meta request

Description of changes:

  • Introduce a new AWS_ERROR_S3EXPRESS_CREATE_SESSION_FAILED for CreateSession failed.
  • Also, removed aws_s3_response_status to use theAWS_HTTP_STATUS_CODE*, there is no reason to keep two different set of enums for the status code. It makes me confused.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

codecov-commenter commented Dec 6, 2023

Codecov Report

Merging #392 (8687160) into main (998e1cb) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #392      +/-   ##
==========================================
- Coverage   88.67%   88.66%   -0.02%     
==========================================
  Files          21       21              
  Lines        5953     5945       -8     
==========================================
- Hits         5279     5271       -8     
  Misses        674      674              
Files Coverage Δ
source/s3.c 95.65% <ø> (ø)
source/s3_auto_ranged_get.c 98.26% <100.00%> (ø)
source/s3_auto_ranged_put.c 92.67% <100.00%> (ø)
source/s3_copy_object.c 83.05% <100.00%> (ø)
source/s3_meta_request.c 90.52% <ø> (-0.21%) ⬇️
source/s3express_credentials_provider.c 92.48% <100.00%> (+0.25%) ⬆️

@@ -314,16 +314,18 @@ static void s_on_request_finished(
struct aws_credentials *credentials = NULL;
int error_code = meta_request_result->error_code;

if (error_code == AWS_ERROR_SUCCESS && meta_request_result->response_status != 200) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old logic seemed better, where we only set the special error code if the response was successfully received.

In the new way, there's no way to distinguish 4xx responses from "the connection died before I got a response".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

I am checking the request sent via the error response body to be empty or not.

error_code = AWS_ERROR_S3EXPRESS_CREATE_SESSION_FAILED;
AWS_LOGF_ERROR(
AWS_LS_AUTH_CREDENTIALS_PROVIDER,
"(id=%p): CreateSession call failed with http status: %d, and error response body is: %.*s",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, logging the response body 👍

@TingDaoK TingDaoK merged commit fcd7a10 into main Dec 7, 2023
@TingDaoK TingDaoK deleted the CreateSessionErrorCode branch December 7, 2023 23:59
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.

4 participants