File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,11 @@ def wrapper(*args, **kwargs):
3939 retry_reason = 'throttled by platform'
4040 elif is_retryable is not None :
4141 retry_reason = is_retryable (err )
42- elif type (err ) in on :
43- retry_reason = f'{ type (err ).__name__ } is allowed to retry'
42+ elif on is not None :
43+ for err_type in on :
44+ if not isinstance (err , err_type ):
45+ continue
46+ retry_reason = f'{ type (err ).__name__ } is allowed to retry'
4447
4548 if retry_reason is None :
4649 # raise if exception is not retryable
Original file line number Diff line number Diff line change 22
33import pytest
44
5+ from databricks .sdk .errors import NotFound , ResourceDoesNotExist
56from databricks .sdk .retries import retried
67
78
@@ -41,6 +42,16 @@ def foo():
4142 foo ()
4243
4344
45+ def test_match_on_subclass ():
46+ with pytest .raises (TimeoutError ):
47+
48+ @retried (on = [NotFound ], timeout = timedelta (seconds = 0.5 ))
49+ def foo ():
50+ raise ResourceDoesNotExist (...)
51+
52+ foo ()
53+
54+
4455def test_propagates_outside_exception ():
4556 with pytest .raises (KeyError ):
4657
You can’t perform that action at this time.
0 commit comments