@@ -127,38 +127,14 @@ impl Error {
127127 }
128128
129129 /// Determine whether it is a retry later type through [StatusCode]
130- pub fn is_retry_later ( status_code : StatusCode ) -> bool {
131- match status_code {
132- StatusCode :: StorageUnavailable
133- | StatusCode :: RuntimeResourcesExhausted
134- | StatusCode :: Internal => true ,
135-
136- StatusCode :: Success
137- | StatusCode :: Unknown
138- | StatusCode :: Unsupported
139- | StatusCode :: Unexpected
140- | StatusCode :: InvalidArguments
141- | StatusCode :: InvalidSyntax
142- | StatusCode :: PlanQuery
143- | StatusCode :: EngineExecuteQuery
144- | StatusCode :: TableAlreadyExists
145- | StatusCode :: TableNotFound
146- | StatusCode :: TableColumnNotFound
147- | StatusCode :: TableColumnExists
148- | StatusCode :: DatabaseNotFound
149- | StatusCode :: UserNotFound
150- | StatusCode :: UnsupportedPasswordType
151- | StatusCode :: UserPasswordMismatch
152- | StatusCode :: AuthHeaderNotFound
153- | StatusCode :: InvalidAuthHeader
154- | StatusCode :: AccessDenied => false ,
155- }
130+ pub fn is_retry_later ( & self ) -> bool {
131+ matches ! ( self , Error :: RetryLater { .. } )
156132 }
157133
158134 /// Creates a new [Error::RetryLater] or [Error::External] error from source `err` according
159135 /// to its [StatusCode].
160136 pub fn from_error_ext < E : ErrorExt + Send + Sync + ' static > ( err : E ) -> Self {
161- if Error :: is_retry_later ( err. status_code ( ) ) {
137+ if err. status_code ( ) . is_retryable ( ) {
162138 Error :: retry_later ( err)
163139 } else {
164140 Error :: external ( err)
0 commit comments