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

feat: add support for 'error_info' #307

Closed
wants to merge 7 commits into from

Conversation

atulep
Copy link
Contributor

@atulep atulep commented Nov 8, 2021

Adds error_info field to GoogleAPICallError, as requested in #286.

@atulep atulep requested review from summer-ji-eng and a team November 8, 2021 21:32
@atulep atulep requested a review from a team as a code owner November 8, 2021 21:32
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 8, 2021
@tseaver tseaver changed the title feat: Adds support for error_info. feat: add support for 'error_info' Nov 9, 2021
Copy link
Contributor

@tseaver tseaver left a comment

Choose a reason for hiding this comment

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

All returns from _parse_grpc_error_details must return a 2-tuple.

google/api_core/exceptions.py Outdated Show resolved Hide resolved
Co-authored-by: Tres Seaver <tseaver@palladion.com>
@google-cla
Copy link

google-cla bot commented Nov 9, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Nov 9, 2021
@google-cla
Copy link

google-cla bot commented Nov 9, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Nov 9, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@tseaver
Copy link
Contributor

tseaver commented Nov 9, 2021

@googlebot I consent.

@google-cla
Copy link

google-cla bot commented Nov 9, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@tseaver
Copy link
Contributor

tseaver commented Nov 9, 2021

@atulep The CLA bot has (once again) lost its tiny mind. You'll need to remove the cla: no label and add the cla: yes label manually.

@atulep
Copy link
Contributor Author

atulep commented Nov 10, 2021

@atulep The CLA bot has (once again) lost its tiny mind. You'll need to remove the cla: no label and add the cla: yes label manually.

Hey @tseaver, it seems to complain because email used in the commit "@palladion.com" is different than the one you used to sign CLA with. The docs suggest "If the email address does not match an email found, please ask the contributor to either add their new email address to their CLA or rebase their commits with their correct email address." Can you please do that?

Copy link

@summer-ji-eng summer-ji-eng left a comment

Choose a reason for hiding this comment

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

Left one comment, other than that, looks good to me. :)

@tseaver
Copy link
Contributor

tseaver commented Nov 10, 2021

@atulep

it seems to complain because email used in the commit "@palladion.com" is different than the one you used to sign CLA with.

The error message is incorrect -- all my commits in the googleapis / GoogleCloudPlatform organzations for the past seven years have been signed with that e-mail address, which is also the only one associated with my Github profile. Sometimes (I don't know that pattern) the bot balks at merged through-the-web suggestions (which is the case here).

tests/unit/test_exceptions.py Show resolved Hide resolved
google/api_core/exceptions.py Show resolved Hide resolved
@atulep
Copy link
Contributor Author

atulep commented Nov 10, 2021

@atulep

it seems to complain because email used in the commit "@palladion.com" is different than the one you used to sign CLA with.

The error message is incorrect -- all my commits in the googleapis / GoogleCloudPlatform organzations for the past seven years have been signed with that e-mail address, which is also the only one associated with my Github profile. Sometimes (I don't know that pattern) the bot balks at merged through-the-web suggestions (which is the case here).

I checked the internal dashboards, and it shows you signed CLA with a "@gmail.com" address. This is the official instruction I was told to follow:

One of the most common problems is that the git author email in the commit is not an email address associated with a CLA. The solution is to change the git author email to be an address covered by the CLA. That email should also be added to their GitHub account; it doesn't need to be the primary email, but it should be on the account.

I know you're an active contributor, so this is really weird to see an CLA issue. Can you share a similar issue from the past where a Googler manually removed the CLA label? Thank you.

@tseaver
Copy link
Contributor

tseaver commented Nov 10, 2021

@tswast, @busunkim96 Can one of you please tag in on the manual CLA flip?

@tswast tswast added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Nov 10, 2021
@google-cla google-cla bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Nov 10, 2021
@vam-google
Copy link
Contributor

@googlebot I fixed it.

@atulep atulep added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Nov 10, 2021
@google-cla google-cla bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Nov 15, 2021
@atulep atulep added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Nov 15, 2021
@google-cla google-cla bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Nov 15, 2021
@atulep
Copy link
Contributor Author

atulep commented Nov 15, 2021

@summer-ji-eng @tseaver - finally addressed your feedback. Thanks for your comments!

@tseaver tseaver dismissed summer-ji-eng’s stale review November 16, 2021 18:19

Requested changes made in 331d6e3

@tseaver
Copy link
Contributor

tseaver commented Nov 16, 2021

@atulep the CLA flag has to be cleared again after pushing any commit, even a merge.

Copy link

@summer-ji-eng summer-ji-eng left a comment

Choose a reason for hiding this comment

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

🚀

@atulep atulep added the cla: yes This human has signed the Contributor License Agreement. label Nov 17, 2021
@google-cla google-cla bot removed the cla: no This human has *not* signed the Contributor License Agreement. label Nov 17, 2021
@tswast tswast added cla: yes This human has signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Nov 17, 2021
@atulep
Copy link
Contributor Author

atulep commented Nov 17, 2021

@tseaver I manually flipped the flag but it still blocks me from merging.

Copy link
Contributor

@software-dov software-dov left a comment

Choose a reason for hiding this comment

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

Looks good, just some nitpicking.

Comment on lines +161 to +163
if not self._error_info:
return None
return self._error_info.reason
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: we can simplify this to

return self._error_info.reason if self._error_info else None

Comment on lines +175 to +177
if not self._error_info:
return None
return self._error_info.domain
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here: we can use conditional expressions

Comment on lines +189 to +191
if not self._error_info:
return None
return self._error_info.metadata
Copy link
Contributor

Choose a reason for hiding this comment

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

And here, same as above.

Comment on lines +481 to +487
error_info = list(
filter(
lambda detail: detail.get("@type", "")
== "type.googleapis.com/google.rpc.ErrorInfo",
details,
)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: it's more idiomatic to use list comprehensions than list and filter.

error_info_type = "type.googleapis.com/google.rpc.ErrorInfo"
error_info = [d for d in details if d.get("@type", "") == error_info_type]

@atulep
Copy link
Contributor Author

atulep commented Nov 29, 2021

Closing this in favor of #315.

@atulep atulep closed this Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants