Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // 根据https://httpstatuses.com/定义 // 小于1000的是系统内置的报错信息,业务代码也可以使用,但是Equal()比较时候只会比较code码,不会严格比较错误信息 OK = New(200, "200 OK") BadRequest = New(400, "400 Bad Request") Forbidden = New(403, "403 Forbidden") NotFound = New(404, "404 Not Found") PreconditionRequired = New(428, "428 Precondition Required") LimitExceed = New(429, "429 Too Many Requests") ServerClosed = New(444, "444 Server Closed") ClientClosed = New(499, "499 Client Closed") Internal = New(500, "500 Internal Server Error") NotImplemented = New(501, "501 Not Implemented") Deadline = New(504, "504 Timeout") // CustomErr 1000为系统报错和业务报错分界点 // 大于或等于1000的是业务自定义错误,当使用Equal()比较时会严格比较具体报错信息 CustomErr = New(1000, "1000 CustomErr") )
Functions ¶
This section is empty.
Types ¶
type ErrCode ¶
type ErrCode struct {
// contains filtered or unexported fields
}
func (ErrCode) MarshalJSON ¶
func (*ErrCode) UnmarshalJSON ¶
func (*ErrCode) WithDetails ¶
Click to show internal directories.
Click to hide internal directories.