Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ShadowLNC opened this issue Jan 14, 2016 · 2 comments
Closed

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

ShadowLNC opened this issue Jan 14, 2016 · 2 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@ShadowLNC
Copy link

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).

@KillianKemps
Copy link

👍 I encountered this same issue. Fortunately, I could fix my problem because you documented another issue #164 very well

@theacodes
Copy link
Contributor

Thanks for reporting this. If anyone wants to send a PR to fix this, I'll be happy to review and merge.

@theacodes theacodes added the type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. label Aug 8, 2016
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants