DecodeWithCommonError 将返回值按照 CommonError 解析
(response []byte, apiName string)
| 28 | |
| 29 | // DecodeWithCommonError 将返回值按照 CommonError 解析 |
| 30 | func DecodeWithCommonError(response []byte, apiName string) (err error) { |
| 31 | var commError CommonError |
| 32 | err = json.Unmarshal(response, &commError) |
| 33 | if err != nil { |
| 34 | return |
| 35 | } |
| 36 | commError.apiName = apiName |
| 37 | if commError.ErrCode != 0 { |
| 38 | return &commError |
| 39 | } |
| 40 | return nil |
| 41 | } |
| 42 | |
| 43 | // DecodeWithError 将返回值按照解析 |
| 44 | func DecodeWithError(response []byte, obj interface{}, apiName string) error { |
no outgoing calls
searching dependent graphs…