蓝眼网盘定制版
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.

30 lines
501 B

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