MCPcopy Create free account
hub / github.com/openscrm/api-server / StatusCode

Method StatusCode

common/ecode/ecode.go:73–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71}
72
73func (e Code) StatusCode() int {
74 switch e.Code() {
75 case OK.Code():
76 return http.StatusOK
77 case InternalError.Code():
78 return http.StatusInternalServerError
79 case InvalidParams.Code():
80 return http.StatusBadRequest
81 case NoPermissionError.Code():
82 fallthrough
83 case TokDetailExpiredError.Code():
84 fallthrough
85 case InvalidTokDetailError.Code():
86 fallthrough
87 case TokDetailRequiredError.Code():
88 return http.StatusUnauthorized
89 case TooManyRequests.Code():
90 return http.StatusTooManyRequests
91 }
92
93 // 重试可解决的返回500
94 // 需要更新请求再重试的200和具体业务error code
95 return http.StatusOK
96}
97
98type Code int
99

Callers

nothing calls this directly

Calls 2

CodeMethod · 0.95
CodeMethod · 0.65

Tested by

no test coverage detected