Closed Wauplin closed 2 months ago
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
As spotted by @osanseviero, this will break an import in datasets-viewer
test suite @severo: https://github.com/huggingface/dataset-viewer/blob/e8e0edfb3e4b76173675d6637c170441abd42141/e2e/tests/utils.py#L15
You can already fix this by doing from huggingface_hub.utils import hf_raise_for_status
.
Thanks for the review @LysandreJik! I addressed @osanseviero 's comment and resolved the merge conflicts. Failing CI is unrelated so I'm merging now.
(sorry for long PR, most of it is moving logic around) Done as part of https://github.com/huggingface/huggingface_hub/issues/2069.
This PR updates how
HfHubHttpError
is formatted. With https://github.com/huggingface/huggingface_hub/issues/2069, all errors are now defined insrc/huggingface_hub/errors.py
with no logic it the module. Before this PR, the logic to format the error message from a server response was split betweenHfHubHttpError.__init__
andhf_raise_for_status
. This should not have being split in the first place (harder to read/investigate)What does this PR do?
HfHubHttpError.__init__
tohf_raise_for_status
. This is the only way to instantiate aHfHubHttpError
anywayhf_raise_for_status
definition inside./utils/_http.py
where it belongs instead of./utils/_errors.py
./utils/_errors.py
module to avoid confusion with./errors.py
where all exceptions are definedrequest_id
/server_message
as attributes. I'm pretty sure it's not used by anyone but at least it keeps backward compatibility.self.assertEquals...
)In the end, sorry for the long diff because 95% of it is simply moving some logic around.