mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-05 22:53:41 +02:00
add client closed (#993)
This commit is contained in:
parent
7bef6cc7d4
commit
5051609aef
@ -77,7 +77,7 @@ func IsServiceUnavailable(err error) bool {
|
||||
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 {
|
||||
return Newf(504, reason, message)
|
||||
}
|
||||
@ -87,3 +87,14 @@ func GatewayTimeout(reason, message string) *Error {
|
||||
func IsGatewayTimeout(err error) bool {
|
||||
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…
Reference in New Issue
Block a user