Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Opaque exception for mismatched Datastore projects #1693

Copy link
Copy link

Description

@bendemaree
Issue body actions

Not a big issue by any means, but in 0.12.0 (w.r.t. v1beta3) requesting a project/dataset that is not correct throws a different exception, and one that is harder to read, than prior versions; the relevant error is in the stack trace, though.

Specifically, this is running against gcd.sh (shipped as gcd-emulator v1beta3-1.0.0 with gcloud) with the flag --project foo.

[snip]
    entities = self.client.get_multi(keys)
../../.virtualenvs/project/lib/python2.7/site-packages/gcloud/datastore/client.py:291: in get_multi
    transaction_id=transaction and transaction.id,
../../.virtualenvs/project/lib/python2.7/site-packages/gcloud/datastore/client.py:123: in _extended_lookup
    transaction_id=transaction_id,
../../.virtualenvs/project/lib/python2.7/site-packages/gcloud/datastore/connection.py:199: in lookup
    _datastore_pb2.LookupResponse)
../../.virtualenvs/project/lib/python2.7/site-packages/gcloud/datastore/connection.py:117: in _rpc
    data=request_pb.SerializeToString())
../../.virtualenvs/project/lib/python2.7/site-packages/gcloud/datastore/connection.py:93: in _request
    error_status = status_pb2.Status.FromString(content)
../../.virtualenvs/project/lib/python2.7/site-packages/google/protobuf/internal/python_message.py:770: in FromString
    message.MergeFromString(s)
../../.virtualenvs/project/lib/python2.7/site-packages/google/protobuf/internal/python_message.py:1091: in MergeFromString
    if self._InternalParse(serialized, 0, length) != length:
../../.virtualenvs/project/lib/python2.7/site-packages/google/protobuf/internal/python_message.py:1117: in InternalParse
    new_pos = local_SkipField(buffer, new_pos, end, tag_bytes)
../../.virtualenvs/project/lib/python2.7/site-packages/google/protobuf/internal/decoder.py:850: in SkipField
    return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, end)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

buffer = 'Hosted project, foo, does not match requested project, bar.', pos = 10
end = 77

    def _RaiseInvalidWireType(buffer, pos, end):
      """Skip function for unknown wire types.  Raises an exception."""

>     raise _DecodeError('Tag had invalid wire type.')
E     DecodeError: Tag had invalid wire type.

The test case for this (prior to 0.12.0) looks for gcloud.exceptions.BadRequest to be raised.

Can reproduce with something like:

from gcloud.datastore import Client, Key
c = Client(project="bar")
c.get(Key("Kind", "some-uuid", project="bar"))
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.