diff options
| author | Vladislav Tupikin <MrRefactoring@yandex.ru> | 2026-04-19 22:24:24 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-19 22:24:24 +0300 |
| commit | 7466916e0206d55826d74f37c251bb5e40182c00 (patch) | |
| tree | 2c887558c71f34b76e541c7bf7d57a420ed3c9ed /web/controller/util.go | |
| parent | 96b568b8389fd5a3ce228d5fb82ec9742d145b15 (diff) | |
Add custom geosite/geoip URL sources (#3980)
* feat: add custom geosite/geoip URL sources
Register DB model, panel API, index/xray UI, and i18n.
* fix
Diffstat (limited to 'web/controller/util.go')
| -rw-r--r-- | web/controller/util.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/web/controller/util.go b/web/controller/util.go index b11203bd..3d266f29 100644 --- a/web/controller/util.go +++ b/web/controller/util.go @@ -50,8 +50,17 @@ func jsonMsgObj(c *gin.Context, msg string, obj any, err error) { } } else { m.Success = false - m.Msg = msg + " (" + err.Error() + ")" - logger.Warning(msg+" "+I18nWeb(c, "fail")+": ", err) + errStr := err.Error() + if errStr != "" { + m.Msg = msg + " (" + errStr + ")" + logger.Warning(msg+" "+I18nWeb(c, "fail")+": ", err) + } else if msg != "" { + m.Msg = msg + logger.Warning(msg + " " + I18nWeb(c, "fail")) + } else { + m.Msg = I18nWeb(c, "somethingWentWrong") + logger.Warning(I18nWeb(c, "somethingWentWrong") + " " + I18nWeb(c, "fail")) + } } c.JSON(http.StatusOK, m) } |
