Skip to content

BatchError is unprintable using default constructor (one string) #165

@ShadowLNC

Description

@ShadowLNC

This one should be pretty simple, I hope.

Here's the constructor signature: def __init__(self, reason, resp=None, content=None):, which doesn't require resp to be defined, and I can see it is not defined most of the time, for example, in googleapiclient/http.py.

Then, given the representation method:

def __repr__(self): return '<BatchError %s "%s">' % (self.resp.status, self.reason) 

Which is also the string method:

__str__ = __repr__ 

This results in unprintable exceptions where resp is undefined, which is not very helpful when attempting to understand the error (e.g. #164).

Metadata

Metadata

Labels

🚨This issue needs some love.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions