feat: enhance error handling with internationalized messages across services and locales

This commit is contained in:
mlogclub
2026-06-02 21:10:17 +08:00
parent 0b4a1b4594
commit 5b6c54de34
14 changed files with 109 additions and 42 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
package params
import (
"agent-desk/internal/pkg/errorsx"
"errors"
"fmt"
"log/slog"
@@ -182,7 +183,7 @@ func FormValue(ctx *gin.Context, name string) string {
func FormValueRequired(ctx *gin.Context, name string) (string, error) {
str := FormValue(ctx, name)
if len(str) == 0 {
return "", errors.New("参数:" + name + "不能为空")
return "", errorsx.InvalidParamI18n("error.param.required", name)
}
return str, nil
}