代码拉取完成,页面将自动刷新
package errors
import "net/http"
func BadRequest(reason, message string) *Error {
return New(http.StatusBadRequest, reason, message)
}
func IsBadRequest(err error) bool {
return Code(err) == http.StatusBadRequest // 400
}
func Unauthorized(reason, message string) *Error {
return New(http.StatusUnauthorized, reason, message)
}
func IsUnauthorized(err error) bool {
return Code(err) == http.StatusUnauthorized // 401
}
func Forbidden(reason, message string) *Error {
return New(http.StatusForbidden, reason, message)
}
func IsForbidden(err error) bool {
return Code(err) == http.StatusForbidden // 403
}
func NotFound(reason, message string) *Error {
return New(http.StatusNotFound, reason, message)
}
func IsNotFound(err error) bool {
return Code(err) == http.StatusNotFound // 404
}
func Conflict(reason, message string) *Error {
return New(http.StatusConflict, reason, message)
}
func IsConflict(err error) bool {
return Code(err) == http.StatusConflict // 409
}
func InternalServer(reason, message string) *Error {
return New(http.StatusInternalServerError, reason, message)
}
func IsInternalServer(err error) bool {
return Code(err) == http.StatusInternalServerError // 500
}
func ServiceUnavailable(reason, message string) *Error {
return New(http.StatusServiceUnavailable, reason, message)
}
func IsServiceUnavailable(err error) bool {
return Code(err) == http.StatusServiceUnavailable // 503
}
func GatewayTimeout(reason, message string) *Error {
return New(http.StatusGatewayTimeout, reason, message)
}
func IsGatewayTimeout(err error) bool {
return Code(err) == http.StatusGatewayTimeout // 504
}
func ClientClosed(reason, message string) *Error {
return New(499, reason, message) // 非http标准
}
func IsClientClosed(err error) bool {
return Code(err) == 499 // 非http标准
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。