Browse Source

GetCodeNum

wfz 3 years ago
parent
commit
1fde8c73b1
1 changed files with 5 additions and 0 deletions
  1. 5 0
      errors/user.go

+ 5 - 0
errors/user.go

@@ -10,3 +10,8 @@ var (
 	ErrorRechargeNotFind          = codes.Error(30005, "充值套餐不存在")
 	ErrorFreeNumNotEnough         = codes.Error(30006, "免费消息数已用完")
 )
+
+func GetCodeNum(err error) int {
+	code, _ := codes.ParseError(err)
+	return code
+}