update new route middlewares

This commit is contained in:
Jay
2020-08-16 17:39:13 +08:00
parent 77cc488d89
commit b3a93abfb9
29 changed files with 643 additions and 5 deletions
+22
View File
@@ -27,6 +27,28 @@ func (e *APIError) Error() string {
return s
}
func (e *APIError) SetCode(code response.MessageCode) *APIError {
e = &APIError{
status: e.status,
code: &code,
message: e.message,
}
return e
}
func (e *APIError) SetMessage(s string) *APIError {
e = &APIError{
status: e.status,
code: e.code,
message: s,
}
return e
}
func (e *APIError) Code() *response.MessageCode { return e.code }
func (e *APIError) Status() response.RespType { return e.status }
func New(status response.RespType, code ...response.MessageCode) *APIError {
e := &APIError{
status: status,