diff --git a/pkg/common/constant/error.go b/pkg/common/constant/error.go index fa5f3c68b..10d8a219c 100644 --- a/pkg/common/constant/error.go +++ b/pkg/common/constant/error.go @@ -12,36 +12,10 @@ var ( OK = ErrInfo{0, ""} ErrServer = ErrInfo{500, "server error"} - // ErrMysql = ErrInfo{100, ""} - // ErrMongo = ErrInfo{110, ""} - // ErrRedis = ErrInfo{120, ""} ErrParseToken = ErrInfo{700, ParseTokenMsg.Error()} - // ErrCreateToken = ErrInfo{201, "Create token failed"} - // ErrAppServerKey = ErrInfo{300, "key error"} + ErrTencentCredential = ErrInfo{400, ThirdPartyMsg.Error()} - // ErrorUserRegister = ErrInfo{600, "User registration failed"} - // ErrAccountExists = ErrInfo{601, "The account is already registered and cannot be registered again"} - // ErrUserPassword = ErrInfo{602, "User password error"} - // ErrRefreshToken = ErrInfo{605, "Failed to refresh token"} - // ErrAddFriend = ErrInfo{606, "Failed to add friends"} - // ErrAgreeToAddFriend = ErrInfo{607, "Failed to agree application"} - // ErrAddFriendToBlack = ErrInfo{608, "Failed to add friends to the blacklist"} - // ErrGetBlackList = ErrInfo{609, "Failed to get blacklist"} - // ErrDeleteFriend = ErrInfo{610, "Failed to delete friend"} - // ErrGetFriendApplyList = ErrInfo{611, "Failed to get friend application list"} - // ErrGetFriendList = ErrInfo{612, "Failed to get friend list"} - // ErrRemoveBlackList = ErrInfo{613, "Failed to remove blacklist"} - // ErrSearchUserInfo = ErrInfo{614, "Can't find the user information"} - // ErrDelAppleDeviceToken = ErrInfo{615, ""} - // ErrModifyUserInfo = ErrInfo{616, "update user some attribute failed"} - // ErrSetFriendComment = ErrInfo{617, "set friend comment failed"} - // ErrSearchUserInfoFromTheGroup = ErrInfo{618, "There is no such group or the user not in the group"} - // ErrCreateGroup = ErrInfo{619, "create group chat failed"} - // ErrJoinGroupApplication = ErrInfo{620, "Failed to apply to join the group"} - // ErrQuitGroup = ErrInfo{621, "Failed to quit the group"} - // ErrSetGroupInfo = ErrInfo{622, "Failed to set group info"} - // ErrParam = ErrInfo{700, "param failed"} ErrTokenExpired = ErrInfo{701, TokenExpiredMsg.Error()} ErrTokenInvalid = ErrInfo{702, TokenInvalidMsg.Error()} ErrTokenMalformed = ErrInfo{703, TokenMalformedMsg.Error()} diff --git a/pkg/common/token_verify/jwt_token.go b/pkg/common/token_verify/jwt_token.go index 1deeed2de..e5808e5bc 100644 --- a/pkg/common/token_verify/jwt_token.go +++ b/pkg/common/token_verify/jwt_token.go @@ -184,6 +184,12 @@ func ParseToken(tokensString, operationID string) (claims *Claims, err error) { errMsg := "GetClaimFromToken failed ErrTokenUnknown " + err.Error() log.Error(operationID, errMsg) } + info := err.(constant.ErrInfo) + if info == constant.ErrTokenUnknown { + errMsg := "info == constant.ErrTokenUnknown " + err.Error() + log.Error(operationID, errMsg) + } + e := errors.Unwrap(err) if errors.Is(e, constant.ErrTokenUnknown) { errMsg := "ParseToken failed ErrTokenUnknown " + e.Error()