Refine all the panic method.

This commit is contained in:
zicla
2019-04-26 02:50:32 +08:00
parent 8edc30babc
commit 46256439da
13 changed files with 98 additions and 100 deletions

View File

@ -1,7 +1,6 @@
package rest
import (
"fmt"
"net/http"
"tank/rest/config"
"tank/rest/logger"
@ -44,26 +43,6 @@ func (this *Bean) PanicError(err error) {
}
}
//请求参数有问题
func (this *Bean) PanicBadRequest(format string, v ...interface{}) {
panic(result.CustomWebResult(result.CODE_WRAPPER_BAD_REQUEST, fmt.Sprintf(format, v...)))
}
//没有权限
func (this *Bean) PanicUnauthorized(format string, v ...interface{}) {
panic(result.CustomWebResult(result.CODE_WRAPPER_UNAUTHORIZED, fmt.Sprintf(format, v...)))
}
//没有找到
func (this *Bean) PanicNotFound(format string, v ...interface{}) {
panic(result.CustomWebResult(result.CODE_WRAPPER_NOT_FOUND, fmt.Sprintf(format, v...)))
}
//服务器内部出问题
func (this *Bean) PanicServer(format string, v ...interface{}) {
panic(result.CustomWebResult(result.CODE_WRAPPER_SERVER, fmt.Sprintf(format, v...)))
}
//能找到一个user就找到一个
func (this *Bean) findUser(writer http.ResponseWriter, request *http.Request) *User {