Minor cleanup in ViewLatestWorkflowRun
Use `ctx.ServerError` instead of a separate `log.Error` + `ctx.Error`. `ctx.ServerError` does essentially the same thing, but better. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
parent
2d321d27d1
commit
8075721823
1 changed files with 1 additions and 3 deletions
|
@ -22,7 +22,6 @@ import (
|
||||||
"code.gitea.io/gitea/modules/actions"
|
"code.gitea.io/gitea/modules/actions"
|
||||||
"code.gitea.io/gitea/modules/base"
|
"code.gitea.io/gitea/modules/base"
|
||||||
context_module "code.gitea.io/gitea/modules/context"
|
context_module "code.gitea.io/gitea/modules/context"
|
||||||
"code.gitea.io/gitea/modules/log"
|
|
||||||
"code.gitea.io/gitea/modules/storage"
|
"code.gitea.io/gitea/modules/storage"
|
||||||
"code.gitea.io/gitea/modules/timeutil"
|
"code.gitea.io/gitea/modules/timeutil"
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
|
@ -75,8 +74,7 @@ func ViewLatestWorkflowRun(ctx *context_module.Context) {
|
||||||
if errors.Is(err, util.ErrNotExist) {
|
if errors.Is(err, util.ErrNotExist) {
|
||||||
ctx.NotFound("GetLatestRunForBranchAndWorkflow", err)
|
ctx.NotFound("GetLatestRunForBranchAndWorkflow", err)
|
||||||
} else {
|
} else {
|
||||||
log.Error("GetLatestRunForBranchAndWorkflow: %v", err)
|
ctx.ServerError("GetLatestRunForBranchAndWorkflow", err)
|
||||||
ctx.Error(http.StatusInternalServerError, "Unable to get latest run for workflow on branch")
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue