@@ -56,6 +56,28 @@ func IsConflict(err error) bool {
5656 return Code (err ) == 409
5757}
5858
59+ // TooManyRequests new TooManyRequests error that is mapped to an HTTP 429 response.
60+ func TooManyRequests (reason , message string ) * Error {
61+ return New (429 , reason , message )
62+ }
63+
64+ // IsTooManyRequests determines if err is an error which indicates a TooManyRequests error.
65+ // It supports wrapped errors.
66+ func IsTooManyRequests (err error ) bool {
67+ return Code (err ) == 429
68+ }
69+
70+ // ClientClosed new ClientClosed error that is mapped to an HTTP 499 response.
71+ func ClientClosed (reason , message string ) * Error {
72+ return New (499 , reason , message )
73+ }
74+
75+ // IsClientClosed determines if err is an error which indicates a IsClientClosed error.
76+ // It supports wrapped errors.
77+ func IsClientClosed (err error ) bool {
78+ return Code (err ) == 499
79+ }
80+
5981// InternalServer new InternalServer error that is mapped to a 500 response.
6082func InternalServer (reason , message string ) * Error {
6183 return New (500 , reason , message )
@@ -88,14 +110,3 @@ func GatewayTimeout(reason, message string) *Error {
88110func IsGatewayTimeout (err error ) bool {
89111 return Code (err ) == 504
90112}
91-
92- // ClientClosed new ClientClosed error that is mapped to an HTTP 499 response.
93- func ClientClosed (reason , message string ) * Error {
94- return New (499 , reason , message )
95- }
96-
97- // IsClientClosed determines if err is an error which indicates a IsClientClosed error.
98- // It supports wrapped errors.
99- func IsClientClosed (err error ) bool {
100- return Code (err ) == 499
101- }
0 commit comments