Finish the download archive feature.

This commit is contained in:
zicla
2019-05-01 19:53:20 +08:00
parent adf4b9ea5a
commit 5dd0fec953
26 changed files with 492 additions and 255 deletions

20
code/core/handler.go Normal file
View File

@ -0,0 +1,20 @@
package core
//带有panic恢复的方法
func RunWithRecovery(f func()) {
defer func() {
if err := recover(); err != nil {
LOGGER.Error("异步任务错误: %v", err)
}
}()
//执行函数
f()
}
//处理错误的统一方法 可以省去if err!=nil 这段代码
func PanicError(err error) {
if err != nil {
panic(err)
}
}