-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Refactor error system #33610
Refactor error system #33610
Conversation
The error system was abused a lot. For example: does anyone could understand what would happen?
This PR is the first step to cleanup the error system. In the future, ideally we should only call something like |
@@ -42,7 +42,7 @@ func GetAllEmails(ctx *context.APIContext) { | |||
ListOptions: listOptions, | |||
}) | |||
if err != nil { | |||
ctx.Error(http.StatusInternalServerError, "GetAllEmails", err) | |||
ctx.APIError(http.StatusInternalServerError, err) |
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.
ctx.APIError(http.StatusInternalServerError, err) | |
ctx.APIErrorInternal(err) |
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 PR is the first step to cleanup the error system.
There are too many, I will leave them to the future.
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.
Next: Refactor error system #33626
|
||
ctx.JSON(http.StatusInternalServerError, APIError{ | ||
Message: message, | ||
URL: setting.API.SwaggerURL, |
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.
Ah, that code was simply moved.
Still, it looks counter-intuitive to me.
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.
Yes, it's another copy-paste problem in history, people just keep copying unclear code everywhere ......... that's why it needs to regularly maintain the legacy code ........
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.
More backgrounds: the URL field is a quite old design from old code.
I have managed to add some comments for the URL field, that's all what I can do at the moment:
https://github.com/go-gitea/gitea/pull/18111/commits/01f2dfc26236d2066c2901b5fb0845db04652643
* giteaofficial/main: Make actions URL in commit status webhooks absolute (go-gitea#33620) Refactor error system (go-gitea#33626) Move issue pin to an standalone table for querying performance (go-gitea#33452) Run spellcheck on tools directory (go-gitea#33627) Refactor error system (go-gitea#33610) Fix project issues list and counting (go-gitea#33594)
No description provided.