- more append err msg when ebai api failed.

This commit is contained in:
gazebo
2019-03-08 14:35:41 +08:00
parent ba133eb2de
commit 0a0a749274
4 changed files with 27 additions and 22 deletions

View File

@@ -129,17 +129,19 @@ func (a *API) AccessAPI(cmd string, body map[string]interface{}) (retVal *Respon
})
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]))
}
appendErrList := []string{}
for _, key := range []string{
KeyBaiduShopID,
KeyShopID,
KeySkuID,
KeyCustomSkuID,
} {
if body[key] != nil {
appendErrList = append(appendErrList, fmt.Sprintf("[%s:%v]", key, body[key]))
}
err = utils.NewErrorCode(strings.Join(shopInfoList, ",")+", "+codeErr.ErrMsg(), codeErr.Code())
}
if len(appendErrList) > 0 {
err = utils.NewErrorCode(strings.Join(appendErrList, ",")+", "+codeErr.ErrMsg(), codeErr.Code())
}
}
}