add err gateway timeout (#992)

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

@ -76,3 +76,14 @@ func ServiceUnavailable(reason, message string) *Error {
func IsServiceUnavailable(err error) bool { 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.
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…
Cancel
Save