From 74e42da5630f9148faaf6b03bf1ac5724fa86b25 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 10 Dec 2023 17:56:11 +0100 Subject: [PATCH] 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 --- routers/web/repo/actions/view.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go index 67f36d68b5..b6984567e5 100644 --- a/routers/web/repo/actions/view.go +++ b/routers/web/repo/actions/view.go @@ -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)