#1601 support delete issue comment
This commit is contained in:
parent
2295fafb34
commit
899e799459
14 changed files with 113 additions and 27 deletions
File diff suppressed because one or more lines are too long
|
@ -105,6 +105,19 @@ 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) {
|
||||
if errck(err) {
|
||||
ctx.Error(status, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Handle(500, title, err)
|
||||
}
|
||||
|
||||
func (ctx *Context) HandleText(status int, title string) {
|
||||
if (status/100 == 4) || (status/100 == 5) {
|
||||
log.Error(4, "%s", title)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue