-
Notifications
You must be signed in to change notification settings - Fork 107
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
DBS3Upload: check error message from the response body attribute #10961
Conversation
Jenkins results:
|
This patch has been already tested in testbed (WMA 1.5.7) and it works like a charm. |
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.
Even though the change is trivial I doubt it is correct. You should never rely on body to treat the errors. The typical example is this. In DBS Python server the exceptions send as dicts. In Go Server all results, including errors are send as lists. Moreover, the server should be free to change its error representation at any time which implies that client should be able to treat errors correctly. The Body part is only for information and information can be changed over time. Therefore, the code may break depending how you read the body, e.g. if exception contains word "body" or not (for example in Go there is no concept of exceptions even though I followed DBS Python way to create error messages). The more reliable way to check for errors is to read HTTP code instead of the body. Even though I'll approve this change I suggest to pay attention to such exception handling. I understand that it may require lots of changes in different places to use HTTP code instead of body, but this is correct way to do it.
Thanks for this review, Valentin. The big problem here is that HTTP error code is |
@amaltaro , yes, we should use different HTTP error codes, but their set is limited. You can easily see all of them here. What probably should be done is standardization of DBS error codes and DBS error message(s). For instance, each DBS error message should have:
With such convention we can come up with standard parser on a client side such that application will know exactly what each error message is and how to parse it. I already have some structure in new DBS server and it can be improved further once we made a decision about standard error format/codes. |
Ok, I suggest we follow this up on this issue that I just created: #10962 |
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.
Thanks @amaltaro
The change indeed looks trivial and I have nothing more to add other than what has already been discussed with Valentin.
Fixes #10960
Status
ready
Description
It isn't clear why we have this new behaviour now, but it could be from the new version of dbs3-client/pycurl.
When looking up at the error message, use the
body
attribute of the HTTP response object, which would have something like:different than the stringyfication of the exception object, which was giving us only this message:
Is it backward compatible (if not, which system it affects?)
YES
Related PRs
None
External dependencies / deployment changes
None