fix: 修复关闭SSH终端标签页时会话状态未更新的问题

This commit is contained in:
2026-04-18 02:35:38 +08:00
commit 6e2e2f9387
43467 changed files with 5489040 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
package middleware
import (
"fmt"
"next-terminal/server/log"
"next-terminal/server/api"
"github.com/labstack/echo/v4"
)
func ErrorHandler(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
if err := next(c); err != nil {
fmt.Printf("%+v\n", err)
log.Error("api error", log.NamedError("err", err))
if he, ok := err.(*echo.HTTPError); ok {
message := fmt.Sprintf("%v", he.Message)
return api.Fail(c, he.Code, message)
}
return api.Fail(c, -1, err.Error())
}
return nil
}
}