Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed word #149

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/chinese/10-错误处理.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const OK uint32 = 200

//全局错误码
const SERVER_COMMON_ERROR uint32 = 100001
const REUQEST_PARAM_ERROR uint32 = 100002
const REQUEST_PARAM_ERROR uint32 = 100002
const TOKEN_EXPIRE_ERROR uint32 = 100003
const TOKEN_GENERATE_ERROR uint32 = 100004
const DB_ERROR uint32 = 100005
Expand All @@ -70,7 +70,7 @@ func init() {
message = make(map[uint32]string)
message[OK] = "SUCCESS"
message[SERVER_COMMON_ERROR] = "服务器开小差啦,稍后再来试一试"
message[REUQEST_PARAM_ERROR] = "参数错误"
message[REQUEST_PARAM_ERROR] = "参数错误"
message[TOKEN_EXPIRE_ERROR] = "token失效,请重新登陆"
message[TOKEN_GENERATE_ERROR] = "生成token失败"
message[DB_ERROR] = "数据库繁忙,请稍后再试"
Expand Down Expand Up @@ -382,8 +382,8 @@ ParamErrorResult很简单,专门处理参数错误的
```
//http 参数错误返回
func ParamErrorResult(r *http.Request, w http.ResponseWriter, err error) {
errMsg := fmt.Sprintf("%s ,%s", xerr.MapErrMsg(xerr.REUQEST_PARAM_ERROR), err.Error())
httpx.WriteJson(w, http.StatusBadRequest, Error(xerr.REUQEST_PARAM_ERROR, errMsg))
errMsg := fmt.Sprintf("%s ,%s", xerr.MapErrMsg(xerr.REQUEST_PARAM_ERROR), err.Error())
httpx.WriteJson(w, http.StatusBadRequest, Error(xerr.REQUEST_PARAM_ERROR, errMsg))
}
```

Expand Down
8 changes: 4 additions & 4 deletions doc/english/10-Error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const OK uint32 = 200

//global error code
const SERVER_COMMON_ERROR uint32 = 100001
const REUQEST_PARAM_ERROR uint32 = 100002
const REQUEST_PARAM_ERROR uint32 = 100002
const TOKEN_EXPIRE_ERROR uint32 = 100003
const TOKEN_GENERATE_ERROR uint32 = 100004
const DB_ERROR uint32 = 100005
Expand All @@ -71,7 +71,7 @@ func init() {
message = make(map[uint32]string)
message[OK] = "SUCCESS"
message[SERVER_COMMON_ERROR] = "The server is deserted, try again later"
message[REUQEST_PARAM_ERROR] = "Parameter error"
message[REQUEST_PARAM_ERROR] = "Parameter error"
message[TOKEN_EXPIRE_ERROR] = "token is invalid, please log in again"
message[TOKEN_GENERATE_ERROR] = "Failed to generate a token"
message[DB_ERROR] = "The database is busy, please try again later"
Expand Down Expand Up @@ -369,8 +369,8 @@ ParamErrorResult is very simple, dedicated to handling parameter errors
```
//http Parameter error returned
func ParamErrorResult(r *http.Request, w http.ResponseWriter, err error) {
errMsg := fmt.Sprintf("%s ,%s", xerr.MapErrMsg(xerr.REUQEST_PARAM_ERROR), err.Error())
httpx.WriteJson(w, http.StatusBadRequest, Error(xerr.REUQEST_PARAM_ERROR, errMsg))
errMsg := fmt.Sprintf("%s ,%s", xerr.MapErrMsg(xerr.REQUEST_PARAM_ERROR), err.Error())
httpx.WriteJson(w, http.StatusBadRequest, Error(xerr.REQUEST_PARAM_ERROR, errMsg))
}
```

Expand Down
4 changes: 2 additions & 2 deletions pkg/result/httpResult.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ func AuthHttpResult(r *http.Request, w http.ResponseWriter, resp interface{}, er

// http 参数错误返回
func ParamErrorResult(r *http.Request, w http.ResponseWriter, err error) {
errMsg := fmt.Sprintf("%s ,%s", xerr.MapErrMsg(xerr.REUQEST_PARAM_ERROR), err.Error())
httpx.WriteJson(w, http.StatusBadRequest, Error(xerr.REUQEST_PARAM_ERROR, errMsg))
errMsg := fmt.Sprintf("%s ,%s", xerr.MapErrMsg(xerr.REQUEST_PARAM_ERROR), err.Error())
httpx.WriteJson(w, http.StatusBadRequest, Error(xerr.REQUEST_PARAM_ERROR, errMsg))
}
2 changes: 1 addition & 1 deletion pkg/xerr/errCode.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const OK uint32 = 200

//全局错误码
const SERVER_COMMON_ERROR uint32 = 100001
const REUQEST_PARAM_ERROR uint32 = 100002
const REQUEST_PARAM_ERROR uint32 = 100002
const TOKEN_EXPIRE_ERROR uint32 = 100003
const TOKEN_GENERATE_ERROR uint32 = 100004
const DB_ERROR uint32 = 100005
Expand Down
2 changes: 1 addition & 1 deletion pkg/xerr/errMsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ func init() {
message = make(map[uint32]string)
message[OK] = "SUCCESS"
message[SERVER_COMMON_ERROR] = "服务器开小差啦,稍后再来试一试"
message[REUQEST_PARAM_ERROR] = "参数错误"
message[REQUEST_PARAM_ERROR] = "参数错误"
message[TOKEN_EXPIRE_ERROR] = "token失效,请重新登陆"
message[TOKEN_GENERATE_ERROR] = "生成token失败"
message[DB_ERROR] = "数据库繁忙,请稍后再试"
Expand Down