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 |
| }) | ||
| if err != nil { | ||
| ctx.Error(http.StatusInternalServerError, "GetAllEmails", err) | ||
| ctx.APIError(http.StatusInternalServerError, err) |
There was a problem hiding this comment.
| ctx.APIError(http.StatusInternalServerError, err) | |
| ctx.APIErrorInternal(err) |
There was a problem hiding this comment.
This PR is the first step to cleanup the error system.
There are too many, I will leave them to the future.
|
|
||
| ctx.JSON(http.StatusInternalServerError, APIError{ | ||
| Message: message, | ||
| URL: setting.API.SwaggerURL, |
There was a problem hiding this comment.
Ah, that code was simply moved.
Still, it looks counter-intuitive to me.
There was a problem hiding this comment.
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.
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.