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

32 lines
542 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 {
logger *Logger
8 years ago
}
func (this *Bean) Init() {
this.logger = LOGGER
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})
}