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

Bugfix: Return proper error #27

Merged
merged 2 commits into from
Dec 19, 2020
Merged

Bugfix: Return proper error #27

merged 2 commits into from
Dec 19, 2020

Conversation

avinassh
Copy link
Contributor

  • Bug:

client side errors were not getting properly mapped to the Twirp errors and defaulting to the Unknown error

  • To Reproduce:

return any error from the server and client will print as unknown

  • Cause:

When response status is not 200, we generate an error calling TwirpServerException.from_json, to this method, we send the error code as strings like invalid_argument or permission_denied. If you check TwirpServerException's constructor, it sorta expects code to be of error.Errors instance, if not, it defaults to Errors.Unknown error.

@avinassh avinassh requested a review from ofpiyush December 12, 2020 08:00
@ofpiyush
Copy link
Contributor

ofpiyush commented Dec 13, 2020

The server exception implementation is wrong, it's supposed to check if the code is one of the available enum values only, not an instance

twirp/exceptions.py Show resolved Hide resolved
twirp/errors.py Outdated Show resolved Hide resolved
@avinassh avinassh requested a review from ofpiyush December 19, 2020 16:23
@ofpiyush ofpiyush merged commit cdca925 into verloop:master Dec 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants