Skip to content

Commit

Permalink
docs: show how to use retry_if_not_exception_type
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Jan 5, 2022
1 parent abf859f commit 5a86499
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down

0 comments on commit 5a86499

Please sign in to comment.