1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-03-19 21:18:07 +02:00

add err gateway timeout ()

This commit is contained in:
longxboy 2021-06-02 21:34:38 +08:00 committed by GitHub
parent bfc79d5ef0
commit 7bef6cc7d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
}