From a222815fe5178901c73225a9590b5e63c1e2f378 Mon Sep 17 00:00:00 2001 From: gazebo Date: Tue, 12 Mar 2019 16:40:40 +0800 Subject: [PATCH] - show station info when jd api failed --- platformapi/jdapi/jdapi.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/platformapi/jdapi/jdapi.go b/platformapi/jdapi/jdapi.go index e05b7c62..aa4dfe8f 100644 --- a/platformapi/jdapi/jdapi.go +++ b/platformapi/jdapi/jdapi.go @@ -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 }