Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zahra Rajabi
tweepy
Commits
37e318be
Unverified
Commit
37e318be
authored
Nov 05, 2016
by
Aaron Hill
Browse files
Properly re-raise exceptions during streaming
parent
3b6d52ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
tweepy/streaming.py
View file @
37e318be
...
...
@@ -9,6 +9,7 @@ from __future__ import absolute_import, print_function
import
logging
import
re
import
requests
import
sys
from
requests.exceptions
import
Timeout
from
threading
import
Thread
from
time
import
sleep
...
...
@@ -230,7 +231,7 @@ class Stream(object):
# Connect and process the stream
error_counter
=
0
resp
=
None
exc
eption
=
None
exc
_info
=
None
while
self
.
running
:
if
self
.
retry_count
is
not
None
:
if
error_counter
>
self
.
retry_count
:
...
...
@@ -267,7 +268,7 @@ class Stream(object):
# If it's not time out treat it like any other exception
if
isinstance
(
exc
,
ssl
.
SSLError
):
if
not
(
exc
.
args
and
'timed out'
in
str
(
exc
.
args
[
0
])):
exc
eption
=
exc
exc
_info
=
sys
.
exc_info
()
break
if
self
.
listener
.
on_timeout
()
is
False
:
break
...
...
@@ -277,7 +278,9 @@ class Stream(object):
self
.
snooze_time
=
min
(
self
.
snooze_time
+
self
.
snooze_time_step
,
self
.
snooze_time_cap
)
except
Exception
as
exc
:
exception
=
exc
exc_info
=
sys
.
exc_info
()
print
(
exc_info
)
import
pdb
;
pdb
.
post_mortem
(
exc_info
[
2
])
# any other exception is fatal, so kill loop
break
...
...
@@ -288,10 +291,10 @@ class Stream(object):
self
.
new_session
()
if
exc
eption
:
if
exc
_info
:
# call a handler first so that the exception can be logged.
self
.
listener
.
on_exception
(
exc
eption
)
raise
exc
eption
self
.
listener
.
on_exception
(
exc
_info
[
1
]
)
six
.
re
raise
(
*
exc
_info
)
def
_data
(
self
,
data
):
if
self
.
listener
.
on_data
(
data
)
is
False
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment