🎨 updated error handling logic
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/response"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/utils"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/logic/client"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
@@ -18,7 +19,11 @@ func GenerateClientIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
resp, err := l.GenerateClientId(clientIP)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
httpx.WriteJsonCtx(r.Context(), w, http.StatusInternalServerError, resp)
|
||||
httpx.WriteJsonCtx(
|
||||
r.Context(),
|
||||
w,
|
||||
http.StatusInternalServerError,
|
||||
response.ErrorWithI18n(r.Context(), "system.error"))
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
|
Reference in New Issue
Block a user