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:
@@ -58,7 +58,7 @@ func MustEnableWiki(ctx *context.Context) {
|
||||
ctx.Repo.Repository,
|
||||
ctx.Repo.Permission)
|
||||
}
|
||||
ctx.NotFound("MustEnableWiki", nil)
|
||||
ctx.NotFound(nil)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -485,7 +485,7 @@ func renderEditPage(ctx *context.Context) {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/?action=_pages")
|
||||
}
|
||||
if isRaw {
|
||||
ctx.Error(http.StatusForbidden, "Editing of raw wiki files is not allowed")
|
||||
ctx.HTTPError(http.StatusForbidden, "Editing of raw wiki files is not allowed")
|
||||
}
|
||||
if entry == nil || ctx.Written() {
|
||||
return
|
||||
@@ -509,14 +509,14 @@ func WikiPost(ctx *context.Context) {
|
||||
switch ctx.FormString("action") {
|
||||
case "_new":
|
||||
if !ctx.Repo.CanWrite(unit.TypeWiki) {
|
||||
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
|
||||
ctx.NotFound(nil)
|
||||
return
|
||||
}
|
||||
NewWikiPost(ctx)
|
||||
return
|
||||
case "_delete":
|
||||
if !ctx.Repo.CanWrite(unit.TypeWiki) {
|
||||
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
|
||||
ctx.NotFound(nil)
|
||||
return
|
||||
}
|
||||
DeleteWikiPagePost(ctx)
|
||||
@@ -524,7 +524,7 @@ func WikiPost(ctx *context.Context) {
|
||||
}
|
||||
|
||||
if !ctx.Repo.CanWrite(unit.TypeWiki) {
|
||||
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
|
||||
ctx.NotFound(nil)
|
||||
return
|
||||
}
|
||||
EditWikiPost(ctx)
|
||||
@@ -543,14 +543,14 @@ func Wiki(ctx *context.Context) {
|
||||
return
|
||||
case "_edit":
|
||||
if !ctx.Repo.CanWrite(unit.TypeWiki) {
|
||||
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
|
||||
ctx.NotFound(nil)
|
||||
return
|
||||
}
|
||||
EditWiki(ctx)
|
||||
return
|
||||
case "_new":
|
||||
if !ctx.Repo.CanWrite(unit.TypeWiki) {
|
||||
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
|
||||
ctx.NotFound(nil)
|
||||
return
|
||||
}
|
||||
NewWiki(ctx)
|
||||
@@ -710,7 +710,7 @@ func WikiRaw(ctx *context.Context) {
|
||||
|
||||
if err != nil {
|
||||
if git.IsErrNotExist(err) {
|
||||
ctx.NotFound("findEntryForFile", nil)
|
||||
ctx.NotFound(nil)
|
||||
return
|
||||
}
|
||||
ctx.ServerError("findEntryForfile", err)
|
||||
@@ -746,7 +746,7 @@ func WikiRaw(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.NotFound("findEntryForFile", nil)
|
||||
ctx.NotFound(nil)
|
||||
}
|
||||
|
||||
// NewWiki render wiki create page
|
||||
|
Reference in New Issue
Block a user