mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 18:58:38 +00:00
Refactor error system (#33610)
This commit is contained in:
@@ -200,7 +200,7 @@ func RunnersEdit(ctx *context.Context) {
|
||||
}
|
||||
if !runner.Editable(ownerID, repoID) {
|
||||
err = errors.New("no permission to edit this runner")
|
||||
ctx.NotFound("RunnerDetails", err)
|
||||
ctx.NotFound(err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ func RunnersEditPost(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
if !runner.Editable(ownerID, repoID) {
|
||||
ctx.NotFound("RunnerDetailsEditPost.Editable", util.NewPermissionDeniedErrorf("no permission to edit this runner"))
|
||||
ctx.NotFound(util.NewPermissionDeniedErrorf("no permission to edit this runner"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ func RunnerDeletePost(ctx *context.Context) {
|
||||
}
|
||||
|
||||
if !runner.Editable(rCtx.OwnerID, rCtx.RepoID) {
|
||||
ctx.NotFound("RunnerDeletePost", util.NewPermissionDeniedErrorf("no permission to delete this runner"))
|
||||
ctx.NotFound(util.NewPermissionDeniedErrorf("no permission to delete this runner"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ func findActionsRunner(ctx *context.Context, rCtx *runnersCtx) *actions_model.Ac
|
||||
ctx.ServerError("FindRunner", err)
|
||||
return nil
|
||||
} else if len(got) == 0 {
|
||||
ctx.NotFound("FindRunner", errors.New("runner not found"))
|
||||
ctx.NotFound(errors.New("runner not found"))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -193,7 +193,7 @@ func findActionsVariable(ctx *context.Context, id int64, vCtx *variablesCtx) *ac
|
||||
ctx.ServerError("FindVariables", err)
|
||||
return nil
|
||||
} else if len(got) == 0 {
|
||||
ctx.NotFound("FindVariables", nil)
|
||||
ctx.NotFound(nil)
|
||||
return nil
|
||||
}
|
||||
return got[0]
|
||||
|
@@ -210,7 +210,7 @@ func getCleanupRuleByContext(ctx *context.Context, owner *user_model.User) *pack
|
||||
pcr, err := packages_model.GetCleanupRuleByID(ctx, id)
|
||||
if err != nil {
|
||||
if err == packages_model.ErrPackageCleanupRuleNotExist {
|
||||
ctx.NotFound("", err)
|
||||
ctx.NotFound(err)
|
||||
} else {
|
||||
ctx.ServerError("GetCleanupRuleByID", err)
|
||||
}
|
||||
@@ -221,7 +221,7 @@ func getCleanupRuleByContext(ctx *context.Context, owner *user_model.User) *pack
|
||||
return pcr
|
||||
}
|
||||
|
||||
ctx.NotFound("", fmt.Errorf("PackageCleanupRule[%v] not associated to owner %v", id, owner))
|
||||
ctx.NotFound(fmt.Errorf("PackageCleanupRule[%v] not associated to owner %v", id, owner))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ func MoveColumns(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
if !project.CanBeAccessedByOwnerRepo(ctx.ContextUser.ID, ctx.Repo.Repository) {
|
||||
ctx.NotFound("CanBeAccessedByOwnerRepo", nil)
|
||||
ctx.NotFound(nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user