mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-08 18:23:45 +08:00
fixed: go-api => 增加全局错误处理 handler,修复业务处理异常导致服务退出的 Bug
This commit is contained in:
@@ -48,6 +48,12 @@ func (l *AppLifecycle) OnStop(context.Context) error {
|
||||
|
||||
func main() {
|
||||
logger.Info("Loading config file: ", configFile)
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
logger.Error("Panic Error:", err)
|
||||
}
|
||||
}()
|
||||
|
||||
app := fx.New(
|
||||
// 初始化配置应用配置
|
||||
fx.Provide(func() *types.AppConfig {
|
||||
|
||||
Reference in New Issue
Block a user