GeezerVison is showing github.com — datastore v1beta3 doesn't handle errors properly · Issue #1617 · googleapis/google-cloud-python
datastore v1beta3 doesn't handle errors properly #1617DescriptionIn Datastore v1beta3, the error response is a serialized proto message Status. However, the error handling currently tries to decode it, which can fail with a unicode error.
File "./main.py", line 20, in lookup
print(client.get(key))
File "/Users/pcostello/.local/virtualenvs/gcloud-permissions-v1beta3/src/gcloud/gcloud/datastore/client.py", line 248, in get
deferred=deferred)
File "/Users/pcostello/.local/virtualenvs/gcloud-permissions-v1beta3/src/gcloud/gcloud/datastore/client.py", line 289, in get_multi
transaction_id=transaction and transaction.id,
File "/Users/pcostello/.local/virtualenvs/gcloud-permissions-v1beta3/src/gcloud/gcloud/datastore/client.py", line 122, in _extended_lookup
transaction_id=transaction_id,
File "/Users/pcostello/.local/virtualenvs/gcloud-permissions-v1beta3/src/gcloud/gcloud/datastore/connection.py", line 197, in lookup
_datastore_pb2.LookupResponse)
File "/Users/pcostello/.local/virtualenvs/gcloud-permissions-v1beta3/src/gcloud/gcloud/datastore/connection.py", line 115, in _rpc
data=request_pb.SerializeToString())
File "/Users/pcostello/.local/virtualenvs/gcloud-permissions-v1beta3/src/gcloud/gcloud/datastore/connection.py", line 92, in _request
raise make_exception(headers, content, use_json=False)
File "/Users/pcostello/.local/virtualenvs/gcloud-permissions-v1beta3/src/gcloud/gcloud/exceptions.py", line 181, in make_exception
content = content.decode('utf-8')
File "/Users/pcostello/.local/virtualenvs/gcloud-permissions-v1beta3/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa8 in position 20: invalid start byte
Activitypcostell commented on Mar 15, 2016 ContributorAuthor More actions I attached #1618 which shows what the expected response is. I can updated it and submit it if you want, but it's just a hack to show the issue. dhermes commented on Mar 16, 2016 Thanks @pcostell. We discussed this in #1466 and I added it as a TODO in #1288 but hadn't gotten to it yet.
Some good news is that googleapis-common-protos actually includes status_pb2 so we don't have to do anything extra to get it. pcostell commented on Mar 16, 2016 ContributorAuthor More actions Ah I totally forgot. It seems potentially more important than I realized since now users will fail with utf-8 decoding issues with no indication of the actual error. dhermes commented on Mar 16, 2016 Yes. When reporting an error causes an error, that's a problem pcostell commented on Mar 29, 2016 ContributorAuthor More actions
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|