Don't mask TwythonStreamer exceptions #271
No reviewers
Labels
No labels
Bug
Enhancement
Feature Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: code/twython#271
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dont-catch-streamer-errors"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
Only question is, what is the difference of calling
on_errorwhere you placed it and calling it where it originally is?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.
For some reason I misread and have been, for some time, under the impression that
elsewas always hit (even if an exception is raised) My apologies. Thanks for the fix!Twython 3.1.1 is now available via PyPi!
pip install -I twython