fsspec/gcsfs

`AttributeError` when error is a string in `retry.py`

Closed this issue · 2 comments

It seems like in rare cases GCS returns a string in the "error" field rather than a JSON object here:

error = json.loads(content)["error"]

This causes an attribute error here:

self.message = error_response.get("message", "")

File "[...]/lib/python3.10/site-packages/gcsfs/retry.py", line 21, in __init__
    self.code = error_response.get("code", None)
AttributeError: 'str' object has no attribute 'get'

This happens very rarely and I haven't been able to log exactly what is returned by Google in this case.

Would you like to make a PR with an isinstance on this line?

Would you like to make a PR with an isinstance on this line?

Will do!