Add the file downloader.
This commit is contained in:
10
rest/bean.go
10
rest/bean.go
@ -1,8 +1,11 @@
|
||||
package rest
|
||||
|
||||
import "net/http"
|
||||
|
||||
type IBean interface {
|
||||
Init(context *Context)
|
||||
PanicError(err error);
|
||||
PanicWebError(msg string, code int);
|
||||
}
|
||||
|
||||
type Bean struct {
|
||||
@ -16,6 +19,11 @@ func (this *Bean) Init(context *Context) {
|
||||
//处理错误的统一方法
|
||||
func (this *Bean) PanicError(err error) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
panic(&WebError{Msg: err.Error(), Code: http.StatusInternalServerError})
|
||||
}
|
||||
}
|
||||
|
||||
//处理错误的统一方法
|
||||
func (this *Bean) PanicWebError(msg string, httpStatusCode int) {
|
||||
panic(&WebError{Msg: msg, Code: httpStatusCode})
|
||||
}
|
||||
|
Reference in New Issue
Block a user