Merge remote-tracking branch 'origin/master'

This commit is contained in:
joylink_zhangsai 2023-09-26 10:25:54 +08:00
commit d14b35fb92

View File

@ -43,7 +43,11 @@ func InitServer() *gin.Engine {
engine.Use(ginzap.CustomRecoveryWithZap(zap.L(), true, func(c *gin.Context, e interface{}) {
switch e := e.(type) {
case error:
c.JSON(http.StatusInternalServerError, e)
c.JSON(http.StatusInternalServerError, &dto.ErrorDto{
Code: dto.LogicError,
Tip: dto.ErrorTipMap[dto.LogicError],
Message: e.Error(),
})
case dto.ErrorDto:
e.Tip = dto.ErrorTipMap[e.Code]
c.JSON(http.StatusInternalServerError, e)