- show station info when jd api failed

This commit is contained in:
gazebo
2019-03-12 16:40:40 +08:00
parent 2e1706ce3a
commit a222815fe5

View File

@@ -196,6 +196,22 @@ func (a *API) AccessAPI(apiStr string, jdParams map[string]interface{}) (retVal
return platformapi.ErrLevelCodeIsNotOK, newErr
}
})
if err != nil {
if codeErr, ok := err.(*utils.ErrorWithCode); ok {
appendErrList := []string{}
for _, key := range []string{
KeyOutStationNo,
KeyStationNo,
} {
if jdParams[key] != nil {
appendErrList = append(appendErrList, fmt.Sprintf("[%s:%v]", key, jdParams[key]))
}
}
if len(appendErrList) > 0 {
err = utils.NewErrorCode(strings.Join(appendErrList, ",")+", "+codeErr.ErrMsg(), codeErr.Code())
}
}
}
return retVal, err
}