ebaiapi.IsErrSkuExist, IsErrSkuNotExist
This commit is contained in:
@@ -71,19 +71,24 @@ func IsErrMatch(err error, strCode string, strList []string) (isMatch bool) {
|
||||
if err != nil {
|
||||
if codeErr, ok := err.(*ErrorWithCode); ok {
|
||||
if strCode == "" || codeErr.Code() == strCode {
|
||||
isMatch = len(strList) == 0
|
||||
for _, v := range strList {
|
||||
if strings.Index(codeErr.ErrMsg(), v) >= 0 {
|
||||
isMatch = true
|
||||
break
|
||||
}
|
||||
}
|
||||
isMatch = IsErrMsgMatch(codeErr.ErrMsg(), strList)
|
||||
}
|
||||
}
|
||||
}
|
||||
return isMatch
|
||||
}
|
||||
|
||||
func IsErrMsgMatch(errMsg string, strList []string) (isMatch bool) {
|
||||
isMatch = len(strList) == 0
|
||||
for _, v := range strList {
|
||||
if strings.Index(errMsg, v) >= 0 {
|
||||
isMatch = true
|
||||
break
|
||||
}
|
||||
}
|
||||
return isMatch
|
||||
}
|
||||
|
||||
func GetErrMsg(err error) (errMsg string) {
|
||||
if errExt, ok := err.(*ErrorWithCode); ok {
|
||||
errMsg = errExt.ErrMsg()
|
||||
|
||||
Reference in New Issue
Block a user