-
Notifications
You must be signed in to change notification settings - Fork 230
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
Fixes the missing exception throw action when an api request is executed, like BucketExistsAsync, etc. #1141
base: master
Are you sure you want to change the base?
Fixes the missing exception throw action when an api request is executed, like BucketExistsAsync, etc. #1141
Conversation
50b3c03
to
72b2b07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't really sign off on this. Code can be simplified, but even if you do, this core method changes semantics significantly and may have serious impact on API usage. Instead of returning an error response, this throws an exception instead.
Minio/RequestExtensions.cs
Outdated
throw; | ||
} | ||
|
||
responseResult = new ResponseResult(request, ex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code will never be executed. Because responseResult
is set at line 93, the previous if
statement will always be true and the exception will be rethrown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Minio/RequestExtensions.cs
Outdated
responseResult.Exception = ex; | ||
else | ||
responseResult = new ResponseResult(request, ex); | ||
throw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes no sense to set responseResult.Exception
in the previous line and now rethrow the exception. The caller of this function will never receive the responseResult
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All code from lines 147-155 can be replaced by throw;
and you would have had the same functionality as you implemented right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
@ebozduman even with your suggested changes, that entire error handling does not look very trustworthy to me. @ramondeklein already mentioned some issues. I didn't dig very deep in the code base, but it seems to me that the root cause of all the evil is that there is a mix of throwing exceptions and returning (unthrown) exception objects within the My suggestion would be this (again, I don't really know the code base, so I might miss something): Additional thoughts: I could imagine that the original rationale for transporting exceptions inside of So, again, I think the entire error handling needs simplification and streamlining. Let all exceptions throw. If you want to keep the concept of error handlers, invoke them from within a catch block in an appropriate place, and then re-throw. |
Just merge the obvious fix. This is embarrassing. |
@ebozduman these are the results of my testbench:
Previous versions did throw a |
@rhegner,
|
136a563
to
6de3c2a
Compare
@ebozduman is this done? |
It is incomplete! Replaced the existing hack fix and cleaned up all the extra code. |
@ebozduman Is there anything the community can do to help resolve the issue in the short term? Maybe it is possible to release a beta version so we can test current fixes? |
Fixes #1118
and probably #1114, #1121, #1131 and #1132, ....
There may be some more issues filed for this very same issue.
If I find more, I'll add them here.
#1120 (The PR that tried to fix the issue)