-
Notifications
You must be signed in to change notification settings - Fork 42
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
fix: httpcode error #1257
fix: httpcode error #1257
Conversation
afc872d
to
90c97c2
Compare
d499a6e
to
d9dc0f0
Compare
19362cc
to
954c4da
Compare
errInfo := err.Error()[i+6:] | ||
var gfspErr GfSpError | ||
unmarshalErr := json.Unmarshal([]byte(errInfo), &gfspErr) | ||
if unmarshalErr == nil && gfspErr.HttpStatusCode != 0 { |
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.
What does the 0 here mean? 200 means http is successful.
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.
0 indicates that err information is successfully resolved
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.
Why not use gfspErr.InnerCode != 0
? I think gfspErr.HttpStatusCode
should be 200 by default.
Refine the PR Title, |
done |
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.
LGTM
Description
Addressing the issue of inaccurate error codes in the gateway interface.
Rationale
The error message is lost during the RPC call process, and we need to reparse it.
Example
“the specified bucket does not exist”
The error should return a 404, but it is actually returning a 500.
Changes
Notable changes:
Modified the string method of gfspError to make it easier to parse.
Added parsing logic to the gateway.
Potential Impacts
print log
http code