优化一个问题

This commit is contained in:
Yun
2025-10-26 21:17:00 +08:00
parent 603a9914a5
commit 8ba1db76c0
3 changed files with 19 additions and 5 deletions
+2 -1
View File
@@ -10,6 +10,7 @@ import (
"net/http"
"github.com/yuninks/langx"
"github.com/yuninks/errorx"
"github.com/zeromicro/go-zero/core/trace"
)
@@ -68,7 +69,7 @@ func Error(ctx context.Context, w http.ResponseWriter, err error) {
code := op.defaultErrorCode
msg := "请求失败"
if err != nil {
val, ok := err.(langx.LangError)
val, ok := err.(errorx.ErrorInterface)
if ok {
if langx.GetDefaultCode() != val.GetCode() {
code = val.GetCode()