Skip to content

Commit

Permalink
Merge pull request #337 from william-silversmith/master
Browse files Browse the repository at this point in the history
docs: show how to use retry_if_not_exception_type
  • Loading branch information
Julien Danjou authored Jan 6, 2022
2 parents abf859f + 5a86499 commit 005ef22
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 005ef22

Please sign in to comment.