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

fix: Improve Any decode error #712

Merged
merged 7 commits into from
Oct 22, 2024
Merged

Conversation

MarkDaoust
Copy link
Contributor

@MarkDaoust MarkDaoust commented Oct 1, 2024

Was (useless):

TypeError: Could not convert Any to TimeOfDay

Now:

TypeError: Could not convert `google.protobuf.any_pb2.Any` with underlying type `google.type.Date` to `google.type.TimeOfDay`

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

Fixes #711 🦕

Sorry, something went wrong.

Was:

TypeError: Could not convert Any to PredictLongRunningResponse

Now:

TypeError: Could not convert
   Any[google.ai.generativelanguage.v1main.PredictLongRunningResponse] to
       google.ai.generativelanguage.v1beta.PredictLongRunningResponse
@MarkDaoust MarkDaoust requested review from a team as code owners October 1, 2024 23:53
@product-auto-label product-auto-label bot added the size: xs Pull request size is extra small. label Oct 1, 2024
@ohmayr
Copy link
Contributor

ohmayr commented Oct 4, 2024

@MarkDaoust Hmm looking at your comment above, is this right syntax Any[google.ai.generativelanguage.v1main.PredictLongRunningResponse] for Python?

@ohmayr ohmayr changed the title Improve Any decoding-error. chore: Improve Any decode error Oct 4, 2024
Copy link

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@parthea parthea self-assigned this Oct 9, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@parthea parthea changed the title chore: Improve Any decode error fix: Improve Any decode error Oct 9, 2024
@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: xs Pull request size is extra small. labels Oct 9, 2024
@parthea parthea assigned ohmayr and unassigned parthea and vchudnov-g Oct 9, 2024
@parthea parthea requested a review from ohmayr October 9, 2024 17:06

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
with pytest.raises(
TypeError,
match=re.escape(
"Could not convert `google.protobuf.any_pb2.Any` with underlying type `google.type.Date` to `google.type.TimeOfDay`"
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I reading this correct or should it instead be the following? (My assumption is that the underlying type should be Any).

Suggested change
"Could not convert `google.protobuf.any_pb2.Any` with underlying type `google.type.Date` to `google.type.TimeOfDay`"
"Could not convert `google.type.Date` with underlying type `google.protobuf.any_pb2.Any` to `google.type.TimeOfDay`"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fixed in dc33849

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@parthea parthea enabled auto-merge (squash) October 22, 2024 14:23
@parthea parthea merged commit 0d5ed37 into googleapis:main Oct 22, 2024
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

from_any_pb gives a useless error message when the type names don't match.
4 participants