- refactor RebuildError
- output store and sku info when mtwm api failed
This commit is contained in:
@@ -128,23 +128,11 @@ 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 {
|
||||
appendErrList := []string{}
|
||||
for _, key := range []string{
|
||||
KeyBaiduShopID,
|
||||
KeyShopID,
|
||||
KeySkuID,
|
||||
KeyCustomSkuID,
|
||||
} {
|
||||
if body[key] != nil {
|
||||
appendErrList = append(appendErrList, fmt.Sprintf("[%s:%v]", key, body[key]))
|
||||
}
|
||||
}
|
||||
if len(appendErrList) > 0 {
|
||||
err = utils.NewErrorCode(strings.Join(appendErrList, ",")+", "+codeErr.ErrMsg(), codeErr.Code())
|
||||
}
|
||||
}
|
||||
}
|
||||
err = platformapi.RebuildError(err, body, []string{
|
||||
KeyBaiduShopID,
|
||||
KeyShopID,
|
||||
KeySkuID,
|
||||
KeyCustomSkuID,
|
||||
})
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user