add client closed (#993)

pull/995/head
longxboy 4 years ago committed by GitHub
parent 7bef6cc7d4
commit 5051609aef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      errors/types.go

@ -77,7 +77,7 @@ func IsServiceUnavailable(err error) bool {
return Code(err) == 503 return Code(err) == 503
} }
// GatewayTimeout new ServiceUnavailable 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 Newf(504, reason, message)
} }
@ -87,3 +87,14 @@ func GatewayTimeout(reason, message string) *Error {
func IsGatewayTimeout(err error) bool { func IsGatewayTimeout(err error) bool {
return Code(err) == 504 return Code(err) == 504
} }
// ClientClosed new ClientClosed error that is mapped to a HTTP 499 response.
func ClientClosed(reason, message string) *Error {
return Newf(499, reason, message)
}
// IsClientClosed determines if err is an error which indicates a IsClientClosed error.
// It supports wrapped errors.
func IsClientClosed(err error) bool {
return Code(err) == 499
}

Loading…
Cancel
Save