Code cleanup in the actions.ViewLatest route handler
Based on feedback received after the feature was merged, use `ctx.NotFound` and `ctx.ServerError`, and drop the use of the unnecessary `ctx.Written()`. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
parent
c3f487af49
commit
74e42da563
1 changed files with 2 additions and 4 deletions
|
@ -49,14 +49,12 @@ func View(ctx *context_module.Context) {
|
|||
func ViewLatest(ctx *context_module.Context) {
|
||||
run, err := actions_model.GetLatestRun(ctx, ctx.Repo.Repository.ID)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusNotFound, err.Error())
|
||||
ctx.Written()
|
||||
ctx.NotFound("GetLatestRun", err)
|
||||
return
|
||||
}
|
||||
err = run.LoadAttributes(ctx)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, err.Error())
|
||||
ctx.Written()
|
||||
ctx.ServerError("LoadAttributes", err)
|
||||
return
|
||||
}
|
||||
ctx.Redirect(run.HTMLURL(), http.StatusTemporaryRedirect)
|
||||
|
|
Loading…
Reference in a new issue