Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

Changed error result with response_metadata field #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shollingsworth
Copy link
Contributor

Changed error result with response_metadata field set to something with more context

Turns response.error variable from:
Error: validation_errors
to
Error: validation_errors - [ERROR] Element 2 field 'label' cannot be longer than 24 characters
if the response JSON body has a field response_metadata that is not empty.

…th more context

Turns response.error variable from: `Error: validation_errors` to
`Error: validation_errors - [ERROR] Element 2 field `label` cannot
be longer than 24 characters` if the response JSON body has a field
`response_metadata` that is not empty.
Comment on lines +51 to +55
if self.response_metadata:
self.error = '{} - {}'.format(
self.error,
','.join(self.response_metadata.get('messages')),
)
Copy link
Owner

@os os Feb 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer not to modify the error field. I'm happy to merge it once you remove this bit.

@@ -47,6 +47,12 @@ def __init__(self, body):
self.body = json.loads(body)
self.successful = self.body['ok']
self.error = self.body.get('error')
self.response_metadata = self.body.get('response_metadata')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice 🍰

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants