Refine all the panic method.
This commit is contained in:
21
rest/bean.go
21
rest/bean.go
@ -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 {
|
||||
|
||||
|
Reference in New Issue
Block a user