-
Notifications
You must be signed in to change notification settings - Fork 418
Expose connection errors in HTTPFileSystem._exists #1849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Context: ilastik/ilastik#3019 (the last commit has the workaround without upstreaming this fix) |
|
Hm, in the case that the URL points to a non-existent server, exists(url) would now cause an exception rather than returning False. |
I'd like to make the right choice, but the current implementation makes that impossible, because it doesn't allow the consumer to distinguish errors like non-existent server, Gateway Error and Not Authenticated from "checked successfully, and the file isn't there". Even |
65f8d2f to
04867d4
Compare
|
I get that who knows what people have implemented relying on this, so put it behind a kwarg to maintain the default behaviour (sorry about the multiple pushes, I thought "strict" would mask a kwarg downstream for a sec). |
203b020 to
db97bd1
Compare
|
Bump :) I've modified this so that it doesn't change the current behaviour by default, but adds an option to expose errors so that consumers can implement custom handling if they wish. Regarding parameter naming: I've checked that |
|
Can you please add a test for this? |
|
Good point... I've also added it for the sync implementation while I'm at it. I've implemented it now with the special treatment for 404, consistent with the other request methods. Depending on how the server behaves with 404s, this can be slightly more or slightly less convenient for fsspec consumers, but as long as |
|
(And squash-merge once you're happy, or I can squash it all if you prefer) |
I can't see why blanket-catching all types of network and client-side issues would be a good thing to do here; the git history doesn't explain it, and
test_httppasses for me locally with this change. Encountering an error duringsession.getdoesn't imply the file doesn't exist, so it generally seems wrong to return False.I'm running into this issue because I want to implement retrying if the connection drops or times out. With the current implementation, I can't distinguish whether the server actually doesn't have the file vs. the user's mobile data reception being terrible.