Skip to content

Attribute error thrown in gcloud/exceptions.py #653

@craigloftus

Description

@craigloftus

If I use an incorrect dataset_id I get an AttributeError when I try to make an API call, because payload in the exception is set to b'Backend Error'.

gcloud/exceptions.py in make_exception(response, content, use_json)
186
--> 187 message = payload.get('message', message)
188 errors = payload.get('error', {}).get('errors', ())
189

AttributeError: 'bytes' object has no attribute 'get'

This is with gcloud==0.4.1 on Python 3.4.2.

Code to reproduce:

from gcloud import datastore
datastore.set_defaults(dataset_id=123456789)
query = datastore.Query(kind="SomeKind")
list(query.fetch())

Expected behaviour would be for a helpfully worded exception to be thrown.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions