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

Don't mask TwythonStreamer exceptions #271

Merged
merged 1 commit into from Oct 21, 2013
Merged

Don't mask TwythonStreamer exceptions #271

merged 1 commit into from Oct 21, 2013

Conversation

remram44
Copy link
Contributor

@remram44 remram44 commented Oct 9, 2013

Exceptions in handlers or on_success which subclass ValueError would previously be caught and reported as a JSON decoding problem, and on_error() would be called (with status_code=200).

Note that, unrelated to this, you might want to catch handlers errors somehow, since it would certainly interrupt streaming.

Exceptions in handlers or on_success which subclass ValueError would
previously be caught and reported as a JSON decoding problem, and
on_error() would be called (with status_code=200).
@michaelhelmick
Copy link
Collaborator

Only question is, what is the difference of calling on_error where you placed it and calling it where it originally is?

@remram44
Copy link
Contributor Author

See the description: the difference is that we don't mask exceptions in handlers or in on_success;

try: blocks catch the exception of the code that is in the try: block. If you want to catch the exceptions from decoding json, only the decoding json part should be in the try block.

The else: clause happens if there is no exception.

See the documentation for try.

@michaelhelmick
Copy link
Collaborator

For some reason I misread and have been, for some time, under the impression that else was always hit (even if an exception is raised) My apologies. Thanks for the fix!

michaelhelmick added a commit that referenced this pull request Oct 21, 2013
@michaelhelmick michaelhelmick merged commit 1db20c0 into ryanmcgrath:master Oct 21, 2013
@michaelhelmick
Copy link
Collaborator

Twython 3.1.1 is now available via PyPi!

pip install -I twython

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.

None yet

2 participants