Skip to content

Commit c88b372

Browse files
committed
async: propagate the value from the actual timeout into FSTimeoutError
1 parent c15b586 commit c88b372

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

fsspec/asyn.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,15 @@ def sync(loop, func, *args, timeout=None, **kwargs):
6262
timeout -= 1
6363
if timeout < 0:
6464
raise FSTimeoutError
65-
if isinstance(result[0], asyncio.TimeoutError):
65+
66+
return_result = result[0]
67+
if isinstance(return_result, asyncio.TimeoutError):
6668
# suppress asyncio.TimeoutError, raise FSTimeoutError
67-
raise FSTimeoutError
68-
if isinstance(result[0], BaseException):
69-
raise result[0]
70-
return result[0]
69+
raise FSTimeoutError from return_result
70+
elif isinstance(return_result, BaseException):
71+
raise return_result
72+
else:
73+
return return_result
7174

7275

7376
iothread = [None] # dedicated fsspec IO thread

0 commit comments

Comments
 (0)