From 09adce96d97f43f101fc8389ace00cc6c4c74d56 Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Sun, 20 Oct 2024 01:23:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20panic=E6=97=B6=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.go b/main.go index 1320890..3f9dfd6 100644 --- a/main.go +++ b/main.go @@ -12,6 +12,11 @@ import ( func main() { // 创建 WebSocket 客户端 + defer func() { + if err := recover(); err != nil { + log.Print("Recovered in main:", err) + } + }() gin.SetMode(gin.ReleaseMode) sqlite3.InitDB() client, err := wsclient.NewWebSocketClient("ws", "localhost:3001", "")