fix: perhaps MISSING (#1779)

Change-Id: If09d5e65ea61f7fbf569b3938db10241f32bb64d

Co-authored-by: shenlianfeng <shenlianfeng@bytedance.com>
pull/1783/head
shengwudiyi 3 years ago committed by GitHub
parent f050b07432
commit c250958af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      errors/types.go

@ -3,7 +3,7 @@ package errors
// BadRequest new BadRequest error that is mapped to a 400 response. // BadRequest new BadRequest error that is mapped to a 400 response.
func BadRequest(reason, message string) *Error { func BadRequest(reason, message string) *Error {
return Newf(400, reason, message) return New(400, reason, message)
} }
// IsBadRequest determines if err is an error which indicates a BadRequest error. // IsBadRequest determines if err is an error which indicates a BadRequest error.
@ -14,7 +14,7 @@ func IsBadRequest(err error) bool {
// Unauthorized new Unauthorized error that is mapped to a 401 response. // Unauthorized new Unauthorized error that is mapped to a 401 response.
func Unauthorized(reason, message string) *Error { func Unauthorized(reason, message string) *Error {
return Newf(401, reason, message) return New(401, reason, message)
} }
// IsUnauthorized determines if err is an error which indicates a Unauthorized error. // IsUnauthorized determines if err is an error which indicates a Unauthorized error.
@ -25,7 +25,7 @@ func IsUnauthorized(err error) bool {
// Forbidden new Forbidden error that is mapped to a 403 response. // Forbidden new Forbidden error that is mapped to a 403 response.
func Forbidden(reason, message string) *Error { func Forbidden(reason, message string) *Error {
return Newf(403, reason, message) return New(403, reason, message)
} }
// IsForbidden determines if err is an error which indicates a Forbidden error. // IsForbidden determines if err is an error which indicates a Forbidden error.
@ -36,7 +36,7 @@ func IsForbidden(err error) bool {
// NotFound new NotFound error that is mapped to a 404 response. // NotFound new NotFound error that is mapped to a 404 response.
func NotFound(reason, message string) *Error { func NotFound(reason, message string) *Error {
return Newf(404, reason, message) return New(404, reason, message)
} }
// IsNotFound determines if err is an error which indicates an NotFound error. // IsNotFound determines if err is an error which indicates an NotFound error.
@ -47,7 +47,7 @@ func IsNotFound(err error) bool {
// Conflict new Conflict error that is mapped to a 409 response. // Conflict new Conflict error that is mapped to a 409 response.
func Conflict(reason, message string) *Error { func Conflict(reason, message string) *Error {
return Newf(409, reason, message) return New(409, reason, message)
} }
// IsConflict determines if err is an error which indicates a Conflict error. // IsConflict determines if err is an error which indicates a Conflict error.
@ -58,7 +58,7 @@ func IsConflict(err error) bool {
// InternalServer new InternalServer error that is mapped to a 500 response. // InternalServer new InternalServer error that is mapped to a 500 response.
func InternalServer(reason, message string) *Error { func InternalServer(reason, message string) *Error {
return Newf(500, reason, message) return New(500, reason, message)
} }
// IsInternalServer determines if err is an error which indicates an Internal error. // IsInternalServer determines if err is an error which indicates an Internal error.
@ -69,7 +69,7 @@ func IsInternalServer(err error) bool {
// ServiceUnavailable new ServiceUnavailable error that is mapped to a HTTP 503 response. // ServiceUnavailable new ServiceUnavailable error that is mapped to a HTTP 503 response.
func ServiceUnavailable(reason, message string) *Error { func ServiceUnavailable(reason, message string) *Error {
return Newf(503, reason, message) return New(503, reason, message)
} }
// IsServiceUnavailable determines if err is an error which indicates a Unavailable error. // IsServiceUnavailable determines if err is an error which indicates a Unavailable error.
@ -80,7 +80,7 @@ func IsServiceUnavailable(err error) bool {
// GatewayTimeout new GatewayTimeout error that is mapped to a HTTP 504 response. // GatewayTimeout new GatewayTimeout error that is mapped to a HTTP 504 response.
func GatewayTimeout(reason, message string) *Error { func GatewayTimeout(reason, message string) *Error {
return Newf(504, reason, message) return New(504, reason, message)
} }
// IsGatewayTimeout determines if err is an error which indicates a GatewayTimeout error. // IsGatewayTimeout determines if err is an error which indicates a GatewayTimeout error.
@ -91,7 +91,7 @@ func IsGatewayTimeout(err error) bool {
// ClientClosed new ClientClosed error that is mapped to a HTTP 499 response. // ClientClosed new ClientClosed error that is mapped to a HTTP 499 response.
func ClientClosed(reason, message string) *Error { func ClientClosed(reason, message string) *Error {
return Newf(499, reason, message) return New(499, reason, message)
} }
// IsClientClosed determines if err is an error which indicates a IsClientClosed error. // IsClientClosed determines if err is an error which indicates a IsClientClosed error.

Loading…
Cancel
Save