mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
use ctx.Handle to handle 404 page
This commit is contained in:
parent
ad31893bbb
commit
47493a0191
5 changed files with 34 additions and 20 deletions
|
@ -36,7 +36,7 @@ func Issues(ctx *middleware.Context, params martini.Params) {
|
|||
|
||||
func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) {
|
||||
if !ctx.Repo.IsOwner {
|
||||
ctx.Error(404)
|
||||
ctx.Handle(404, "issue.CreateIssue", nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -65,14 +65,14 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat
|
|||
func ViewIssue(ctx *middleware.Context, params martini.Params) {
|
||||
issueid, err := base.StrTo(params["issueid"]).Int()
|
||||
if err != nil {
|
||||
ctx.Error(404)
|
||||
ctx.Handle(404, "issue.ViewIssue", err)
|
||||
return
|
||||
}
|
||||
|
||||
issue, err := models.GetIssueById(int64(issueid))
|
||||
if err != nil {
|
||||
if err == models.ErrIssueNotExist {
|
||||
ctx.Error(404)
|
||||
ctx.Handle(404, "issue.ViewIssue", err)
|
||||
} else {
|
||||
ctx.Handle(200, "issue.ViewIssue", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue