- try to append shop info in err msg when ebai api failed.

This commit is contained in:
gazebo
2019-03-08 14:10:43 +08:00
parent c0b5c300e4
commit ba133eb2de
2 changed files with 27 additions and 7 deletions

View File

@@ -127,5 +127,21 @@ func (a *API) AccessAPI(cmd string, body map[string]interface{}) (retVal *Respon
}
return platformapi.ErrLevelCodeIsNotOK, newErr
})
if err != nil {
if codeErr, ok := err.(*utils.ErrorWithCode); ok {
if body[KeyBaiduShopID] != nil || body[KeyShopID] != nil {
shopInfoList := []string{}
for _, key := range []string{
KeyBaiduShopID,
KeyShopID,
} {
if body[key] != nil {
shopInfoList = append(shopInfoList, fmt.Sprintf("[%s:%v]", key, body[key]))
}
}
err = utils.NewErrorCode(strings.Join(shopInfoList, ",")+", "+codeErr.ErrMsg(), codeErr.Code())
}
}
}
return retVal, err
}