groupCallback

test-errcode
wangchuxiao 2 years ago
parent 2d67f95413
commit fb1b3687f4

@ -62,6 +62,18 @@ var (
ErrTokenDifferentUserID = ErrInfo{TokenDifferentUserIDError, "TokenDifferentUserIDError", ""} ErrTokenDifferentUserID = ErrInfo{TokenDifferentUserIDError, "TokenDifferentUserIDError", ""}
) )
func NewErrNetwork(err error) error {
newErrNetwork := ErrNetwork
newErrNetwork.DetailErrMsg = err.Error()
return ErrNetwork
}
func NewErrData(err error) error {
newErrData := ErrData
newErrData.DetailErrMsg = err.Error()
return ErrNetwork
}
func toDetail(err error, info ErrInfo) ErrInfo { func toDetail(err error, info ErrInfo) ErrInfo {
errInfo := info errInfo := info
errInfo.DetailErrMsg = err.Error() errInfo.DetailErrMsg = err.Error()

@ -67,13 +67,13 @@ func CallBackPostReturn(url, callbackCommand string, input interface{}, output c
if failedContinue != nil && *failedContinue { if failedContinue != nil && *failedContinue {
return constant.ErrCallbackContinue return constant.ErrCallbackContinue
} }
return constant.ErrNetwork return constant.NewErrNetwork(err)
} }
if err = json.Unmarshal(b, output); err != nil { if err = json.Unmarshal(b, output); err != nil {
if failedContinue != nil && *failedContinue { if failedContinue != nil && *failedContinue {
return constant.ErrCallbackContinue return constant.ErrCallbackContinue
} }
return constant.ErrData return constant.NewErrData(err)
} }
return output.Parse() return output.Parse()
} }

Loading…
Cancel
Save