From 5a8649955a7ed623748a748b27717ffa2e7d2301 Mon Sep 17 00:00:00 2001 From: William Silversmith Date: Wed, 5 Jan 2022 14:53:44 -0500 Subject: [PATCH] docs: show how to use retry_if_not_exception_type --- doc/source/index.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/source/index.rst b/doc/source/index.rst index f8ee2e78..89525281 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -210,6 +210,11 @@ exceptions, as in the cases here. print("Retry forever with no wait if an IOError occurs, raise any other errors") raise Exception + @retry(retry=retry_if_not_exception_type(ClientError)) + def might_client_error(): + print("Retry forever with no wait if any error other than ClientError occurs. Immediately raise ClientError.") + raise Exception + We can also use the result of the function to alter the behavior of retrying. .. testcode::