mirror of
https://github.com/go-kratos/kratos.git
synced 2025-03-19 21:18:07 +02:00
add err gateway timeout (#992)
This commit is contained in:
parent
bfc79d5ef0
commit
7bef6cc7d4
@ -76,3 +76,14 @@ func ServiceUnavailable(reason, message string) *Error {
|
||||
func IsServiceUnavailable(err error) bool {
|
||||
return Code(err) == 503
|
||||
}
|
||||
|
||||
// GatewayTimeout new ServiceUnavailable error that is mapped to a HTTP 504 response.
|
||||
func GatewayTimeout(reason, message string) *Error {
|
||||
return Newf(504, reason, message)
|
||||
}
|
||||
|
||||
// IsGatewayTimeout determines if err is an error which indicates a GatewayTimeout error.
|
||||
// It supports wrapped errors.
|
||||
func IsGatewayTimeout(err error) bool {
|
||||
return Code(err) == 504
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user