Don't mask TwythonStreamer exceptions #271

Merged
remram44 merged 1 commit from dont-catch-streamer-errors into master 2013-10-21 08:19:32 -07:00
remram44 commented 2013-10-09 11:43:04 -07:00 (Migrated from github.com)

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). Note that, unrelated to this, you might want to catch handlers errors somehow, since it would certainly interrupt streaming.
michaelhelmick commented 2013-10-21 07:38:11 -07:00 (Migrated from github.com)

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

Only question is, what is the difference of calling `on_error` where you placed it and calling it where it originally is?
remram44 commented 2013-10-21 08:04:01 -07:00 (Migrated from github.com)

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.

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](http://docs.python.org/2/reference/compound_stmts.html#the-try-statement).
michaelhelmick commented 2013-10-21 08:19:27 -07:00 (Migrated from github.com)

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!

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 commented 2013-12-05 15:17:18 -08:00 (Migrated from github.com)

Twython 3.1.1 is now available via PyPi!

pip install -I twython

Twython 3.1.1 is now available via PyPi! `pip install -I twython`
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: code/twython#271
No description provided.