1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Refactor error system (#33610)

This commit is contained in:
wxiaoguang
2025-02-17 14:13:17 +08:00
committed by GitHub
parent 69de5a65c2
commit f35850f48e
184 changed files with 2100 additions and 2106 deletions

View File

@@ -133,7 +133,7 @@ func UpdateResolveConversation(ctx *context.Context) {
}
if comment.Issue.RepoID != ctx.Repo.Repository.ID {
ctx.NotFound("comment's repoID is incorrect", errors.New("comment's repoID is incorrect"))
ctx.NotFound(errors.New("comment's repoID is incorrect"))
return
}
@@ -143,12 +143,12 @@ func UpdateResolveConversation(ctx *context.Context) {
return
}
if !permResult {
ctx.Error(http.StatusForbidden)
ctx.HTTPError(http.StatusForbidden)
return
}
if !comment.Issue.IsPull {
ctx.Error(http.StatusBadRequest)
ctx.HTTPError(http.StatusBadRequest)
return
}
@@ -159,7 +159,7 @@ func UpdateResolveConversation(ctx *context.Context) {
return
}
} else {
ctx.Error(http.StatusBadRequest)
ctx.HTTPError(http.StatusBadRequest)
return
}
@@ -214,7 +214,7 @@ func renderConversation(ctx *context.Context, comment *issues_model.Comment, ori
} else if origin == "timeline" {
ctx.HTML(http.StatusOK, tplTimelineConversation)
} else {
ctx.Error(http.StatusBadRequest, "Unknown origin: "+origin)
ctx.HTTPError(http.StatusBadRequest, "Unknown origin: "+origin)
}
}