Commit 9a2dbaa0 authored by chenweijian's avatar chenweijian

err

parent a7a91049
...@@ -2,6 +2,7 @@ package myerr ...@@ -2,6 +2,7 @@ package myerr
import ( import (
"fmt" "fmt"
"git.hilo.cn/hilo-common/myerr"
"git.hilo.cn/hilo-common/mylogrus" "git.hilo.cn/hilo-common/mylogrus"
"github.com/pkg/errors" "github.com/pkg/errors"
"strconv" "strconv"
...@@ -225,3 +226,11 @@ func WrapErr(err error) error { ...@@ -225,3 +226,11 @@ func WrapErr(err error) error {
return errors.Wrap(err, "") return errors.Wrap(err, "")
} }
} }
func ToLocal(err *myerr.BusinessError) error {
return &BusinessError{
code: err.GetCode(),
message: err.GetMsg(),
err: err.GetErr(),
}
}
...@@ -156,7 +156,7 @@ func ReplyCpInvite(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -156,7 +156,7 @@ func ReplyCpInvite(c *gin.Context) (*mycontext.MyContext, error) {
return myCtx, err return myCtx, err
} }
if cpRecord == nil || cpRecord.Id == 0 { if cpRecord == nil || cpRecord.Id == 0 {
return myCtx, msg.GetErrByLanguage(model, common.MSG_ID_ALREADY_EXPIRED, lang, comerr.AlreadyExpired) return myCtx, myerr.ToLocal(msg.GetErrByLanguage(model, common.MSG_ID_ALREADY_EXPIRED, lang, comerr.AlreadyExpired))
} }
if optType == 1 { // 接受的时候 if optType == 1 { // 接受的时候
...@@ -316,7 +316,7 @@ func ReplyCpCancel(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -316,7 +316,7 @@ func ReplyCpCancel(c *gin.Context) (*mycontext.MyContext, error) {
return myCtx, err return myCtx, err
} }
if cpCancel == nil || cpCancel.Id == 0 { if cpCancel == nil || cpCancel.Id == 0 {
return myCtx, msg.GetErrByLanguage(model, common.MSG_ID_ALREADY_EXPIRED, lang, comerr.AlreadyExpired) return myCtx, myerr.ToLocal(msg.GetErrByLanguage(model, common.MSG_ID_ALREADY_EXPIRED, lang, comerr.AlreadyExpired))
} }
if optType == 1 { // 撤销,只有自己能撤销自己的申请 if optType == 1 { // 撤销,只有自己能撤销自己的申请
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment