diff --git a/src/common/exceptions.cpp b/src/common/exceptions.cpp index f4c104ed..b812df68 100644 --- a/src/common/exceptions.cpp +++ b/src/common/exceptions.cpp @@ -248,7 +248,7 @@ void PyThrowException(ErrorData &error, PyObject *http_exception) { for (auto &entry : error.ExtraInfo()) { if (entry.first == "status_code") { e.attr("status_code") = std::stoi(entry.second); - } else if (entry.first == "response_body") { + } else if (entry.first == "response_body" || entry.first == "body") { e.attr("body") = entry.second; } else if (entry.first == "reason") { e.attr("reason") = entry.second; diff --git a/tests/extensions/test_httpfs.py b/tests/extensions/test_httpfs.py index 6529271b..2e7c7658 100644 --- a/tests/extensions/test_httpfs.py +++ b/tests/extensions/test_httpfs.py @@ -68,7 +68,8 @@ def test_http_exception(self, require): value = exc.value assert value.status_code != 200 - assert value.body == "" + assert isinstance(value.body, str) + assert value.body != "" assert "Content-Length" in value.headers def test_fsspec_priority(self, require):