蓝眼网盘定制版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

29 lines
501 B

package rest
import "net/http"
type IBean interface {
Init()
PanicError(err error);
PanicWebError(msg string, code int);
}
type Bean struct {
}
func (this *Bean) Init() {
}
//处理错误的统一方法
func (this *Bean) PanicError(err error) {
if err != nil {
panic(&WebError{Msg: err.Error(), Code: http.StatusInternalServerError})
}
}
//处理错误的统一方法
func (this *Bean) PanicWebError(msg string, httpStatusCode int) {
panic(&WebError{Msg: msg, Code: httpStatusCode})
}