1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 10:18:38 +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

@@ -23,7 +23,7 @@ func AddDependency(ctx *context.Context) {
// Check if the Repo is allowed to have dependencies
if !ctx.Repo.CanCreateIssueDependencies(ctx, ctx.Doer, issue.IsPull) {
ctx.Error(http.StatusForbidden, "CanCreateIssueDependencies")
ctx.HTTPError(http.StatusForbidden, "CanCreateIssueDependencies")
return
}
@@ -97,7 +97,7 @@ func RemoveDependency(ctx *context.Context) {
// Check if the Repo is allowed to have dependencies
if !ctx.Repo.CanCreateIssueDependencies(ctx, ctx.Doer, issue.IsPull) {
ctx.Error(http.StatusForbidden, "CanCreateIssueDependencies")
ctx.HTTPError(http.StatusForbidden, "CanCreateIssueDependencies")
return
}
@@ -119,7 +119,7 @@ func RemoveDependency(ctx *context.Context) {
case "blocking":
depType = issues_model.DependencyTypeBlocking
default:
ctx.Error(http.StatusBadRequest, "GetDependecyType")
ctx.HTTPError(http.StatusBadRequest, "GetDependecyType")
return
}