aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routers/repo/issue.go6
-rw-r--r--routers/repo/repo.go32
-rw-r--r--routers/user/user.go2
-rw-r--r--templates/status/404.tmpl7
-rw-r--r--templates/status/500.tmpl7
5 files changed, 34 insertions, 20 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 4cc007e9ee..78fe4b25d0 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -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)
}
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 4782d64f70..0f1ea31235 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -86,7 +86,7 @@ func Branches(ctx *middleware.Context, params martini.Params) {
ctx.Handle(200, "repo.Branches", err)
return
} else if len(brs) == 0 {
- ctx.Error(404)
+ ctx.Handle(404, "repo.Branches", nil)
return
}
@@ -123,8 +123,8 @@ func Single(ctx *middleware.Context, params martini.Params) {
// Branches.
brs, err := models.GetBranches(params["username"], params["reponame"])
if err != nil {
- log.Error("repo.Single(GetBranches): %v", err)
- ctx.Error(404)
+ //log.Error("repo.Single(GetBranches): %v", err)
+ ctx.Handle(404, "repo.Single(GetBranches)", err)
return
} else if ctx.Repo.Repository.IsBare {
ctx.Data["IsBareRepo"] = true
@@ -138,15 +138,15 @@ func Single(ctx *middleware.Context, params martini.Params) {
params["branchname"], params["commitid"], treename)
if err != nil && err != models.ErrRepoFileNotExist {
- log.Error("repo.Single(GetTargetFile): %v", err)
- ctx.Error(404)
+ //log.Error("repo.Single(GetTargetFile): %v", err)
+ ctx.Handle(404, "repo.Single(GetTargetFile)", err)
return
}
branchLink := "/" + ctx.Repo.Owner.LowerName + "/" + ctx.Repo.Repository.Name + "/src/" + params["branchname"]
if len(treename) != 0 && repoFile == nil {
- ctx.Error(404)
+ ctx.Handle(404, "repo.Single", nil)
return
}
@@ -154,8 +154,8 @@ func Single(ctx *middleware.Context, params martini.Params) {
if repoFile.Size > 1024*1024 || repoFile.Filemode != git.FileModeBlob {
ctx.Data["FileIsLarge"] = true
} else if blob, err := repoFile.LookupBlob(); err != nil {
- log.Error("repo.Single(repoFile.LookupBlob): %v", err)
- ctx.Error(404)
+ //log.Error("repo.Single(repoFile.LookupBlob): %v", err)
+ ctx.Handle(404, "repo.Single(repoFile.LookupBlob)", err)
} else {
ctx.Data["IsFile"] = true
ctx.Data["FileName"] = repoFile.Name
@@ -179,8 +179,8 @@ func Single(ctx *middleware.Context, params martini.Params) {
files, err := models.GetReposFiles(params["username"], params["reponame"],
params["branchname"], params["commitid"], treename)
if err != nil {
- log.Error("repo.Single(GetReposFiles): %v", err)
- ctx.Error(404)
+ //log.Error("repo.Single(GetReposFiles): %v", err)
+ ctx.Handle(404, "repo.Single(GetReposFiles)", err)
return
}
@@ -203,8 +203,8 @@ func Single(ctx *middleware.Context, params martini.Params) {
if readmeFile.Size > 1024*1024 || readmeFile.Filemode != git.FileModeBlob {
ctx.Data["FileIsLarge"] = true
} else if blob, err := readmeFile.LookupBlob(); err != nil {
- log.Error("repo.Single(readmeFile.LookupBlob): %v", err)
- ctx.Error(404)
+ //log.Error("repo.Single(readmeFile.LookupBlob): %v", err)
+ ctx.Handle(404, "repo.Single(readmeFile.LookupBlob)", err)
return
} else {
// current repo branch link
@@ -239,7 +239,7 @@ func Single(ctx *middleware.Context, params martini.Params) {
params["branchname"], params["commitid"])
if err != nil {
log.Error("repo.Single(GetCommit): %v", err)
- ctx.Error(404)
+ ctx.Handle(404, "repo.Single(GetCommit)", err)
return
}
ctx.Data["LastCommit"] = commit
@@ -275,7 +275,7 @@ func Http(ctx *middleware.Context, params martini.Params) {
func Setting(ctx *middleware.Context, params martini.Params) {
if !ctx.Repo.IsOwner {
- ctx.Error(404)
+ ctx.Handle(404, "repo.Setting", nil)
return
}
@@ -307,7 +307,7 @@ func Commits(ctx *middleware.Context, params martini.Params) {
ctx.Handle(200, "repo.Commits", err)
return
} else if len(brs) == 0 {
- ctx.Error(404)
+ ctx.Handle(404, "repo.Commits", nil)
return
}
@@ -315,7 +315,7 @@ func Commits(ctx *middleware.Context, params martini.Params) {
commits, err := models.GetCommits(params["username"],
params["reponame"], params["branchname"])
if err != nil {
- ctx.Error(404)
+ ctx.Handle(404, "repo.Commits", nil)
return
}
ctx.Data["Username"] = params["username"]
diff --git a/routers/user/user.go b/routers/user/user.go
index c34b529ec3..a0321f187b 100644
--- a/routers/user/user.go
+++ b/routers/user/user.go
@@ -301,7 +301,7 @@ func Activate(ctx *middleware.Context) {
if len(code) == 0 {
ctx.Data["IsActivatePage"] = true
if ctx.User.IsActive {
- ctx.Error(404)
+ ctx.Handle(404, "user.Activate", nil)
return
}
// Resend confirmation e-mail.
diff --git a/templates/status/404.tmpl b/templates/status/404.tmpl
new file mode 100644
index 0000000000..4e836b228d
--- /dev/null
+++ b/templates/status/404.tmpl
@@ -0,0 +1,7 @@
+{{template "base/head" .}}
+{{template "base/navbar" .}}
+<div id="gogs-body" class="container">
+ <h4>This page is not found !</h4>
+ <p>Application Version: {{AppVer}}</p>
+</div>
+{{template "base/footer" .}} \ No newline at end of file
diff --git a/templates/status/500.tmpl b/templates/status/500.tmpl
new file mode 100644
index 0000000000..9a00eb1ff7
--- /dev/null
+++ b/templates/status/500.tmpl
@@ -0,0 +1,7 @@
+{{template "base/head" .}}
+{{template "base/navbar" .}}
+<div id="gogs-body" class="container">
+ <p>An error is occurred : {{.ErrorMsg}}</p>
+ <p>Application Version: {{AppVer}}</p>
+</div>
+{{template "base/footer" .}} \ No newline at end of file