summaryrefslogtreecommitdiffstats
path: root/modules/context/context.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-30 02:08:38 -0700
committerUnknwon <u@gogs.io>2016-08-30 02:08:38 -0700
commit780cc2d11093e048e41f2d6da9d76f6c6ac4a5e2 (patch)
tree1657d9fecdcf70d4e0067724344f531d608efb71 /modules/context/context.go
parent2a13f682e0fa039a610e7817495d87685f9632f2 (diff)
downloadgitea-780cc2d11093e048e41f2d6da9d76f6c6ac4a5e2.tar.gz
gitea-780cc2d11093e048e41f2d6da9d76f6c6ac4a5e2.zip
router/repo: code refactoring
Diffstat (limited to 'modules/context/context.go')
-rw-r--r--modules/context/context.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/context/context.go b/modules/context/context.go
index 971d075d0f..ac46bb38fb 100644
--- a/modules/context/context.go
+++ b/modules/context/context.go
@@ -105,13 +105,12 @@ func (ctx *Context) Handle(status int, title string, err error) {
ctx.HTML(status, base.TplName(fmt.Sprintf("status/%d", status)))
}
-// HandleError use error check function to determine if server should
-// response as client input error or server internal error.
-// It responses with given status code for client error,
-// or error context description for logging purpose of server error.
-func (ctx *Context) HandleError(title string, errck func(error) bool, err error, status int) {
+// NotFoundOrServerError use error check function to determine if the error
+// is about not found. It responses with 404 status code for not found error,
+// or error context description for logging purpose of 500 server error.
+func (ctx *Context) NotFoundOrServerError(title string, errck func(error) bool, err error) {
if errck(err) {
- ctx.Error(status, err.Error())
+ ctx.Handle(404, title, err)
return
}