Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Fix test for absent return values in thrift scheme #221

Merged
merged 1 commit into from
Oct 12, 2015
Merged

Conversation

abhinav
Copy link
Contributor

@abhinav abhinav commented Oct 12, 2015

thriftrw now raises TypeError if return value is absent for non-void methods.

@breerly @blampe @junchaoWu

thriftrw now raises TypeError if return value is absent for non-void methods.
@jc-fireball
Copy link
Contributor

lgtm thx for thefix

# response. thriftrw will fail with a TypeError on invalid values. For
# thrift, we'll check manually and raise ValueExpectedError.
if use_thriftrw_client:
exc = TypeError
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be caught and re-raised as ValueExpectedError for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TypeError can also be raised if required arguments in a struct were absent, or on type mismatch. There's no error specific to "return value was absent" raised by thriftrw yet. I can fix that in the next version along with the unexpected exceptions support. Created thriftrw/thriftrw-python#49.

Meanwhile this fix should suffice because this is a very specific corner case that will happen only if the server is using Apache Thrift, the client is using thriftrw, and the server forgets to return a value (which would normally be caught by their tests/manual checks). And when it does occur, there's no good way for the client to handle it except blow up.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure sounds good!

abhinav added a commit that referenced this pull request Oct 12, 2015
Fix test for absent return values in thrift scheme
@abhinav abhinav merged commit cf6d6b6 into master Oct 12, 2015
@abhinav abhinav deleted the abg/testfix branch October 12, 2015 22:28
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.

3 participants