Skip to content

Commit db97bd1

Browse files
committed
Add option to expose connection errors in httpfs.exists
1 parent 695f14e commit db97bd1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fsspec/implementations/http.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ async def gen_chunks():
326326
async with meth(self.encode_url(rpath), data=gen_chunks(), **kw) as resp:
327327
self._raise_not_found_for_status(resp, rpath)
328328

329-
async def _exists(self, path, **kwargs):
329+
async def _exists(self, path, strict=False, **kwargs):
330330
kw = self.kwargs.copy()
331331
kw.update(kwargs)
332332
try:
@@ -336,7 +336,10 @@ async def _exists(self, path, **kwargs):
336336
async with r:
337337
return r.status < 400
338338
except aiohttp.ClientError:
339-
return False
339+
if strict:
340+
raise
341+
else:
342+
return False
340343

341344
async def _isfile(self, path, **kwargs):
342345
return await self._exists(path, **kwargs)

0 commit comments

Comments
 (0)