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

heartbeat_thread of HeartbeatListener, need to handle network error #40

Closed
Robert-Wang-sz opened this issue Jul 8, 2015 · 4 comments
Closed

Comments

@Robert-Wang-sz
Copy link

Code:

try:
self.transport.transmit(utils.Frame(None, {}, None))
except exception.NotConnectedException:

logger.Log.instance().debug("Lost connection, unable to send heartbeat")

need to fix as:


try:
self.transport.transmit(utils.Frame(None, {}, None))
except exception.NotConnectedException:
logger.Log.instance().debug("Lost connection, unable to send heartbeat")
excep Exception:

logger.Log.instance().debug("Error sending heartbeat frame")

@jasonrbriggs
Copy link
Owner

Sorry, but don't understand the difference. Slight change to the error message doesn't make much difference in my opinion.

@estadtherr
Copy link

It looks like he wants a handler for "Exception" in addition to the handler for "NotConnectedException". I personally try to stay away from blanket catching of "Exception", since that will catch programming errors in addition to runtime errors, but that seems like the request.

@jasonrbriggs
Copy link
Owner

Ah. The bold bits kind-of caught me out. Pretty obvious now you point it out.

Agreed in general, regarding catching Exception, but in this case it's the heartbeat loop. Not 100% sure on reflection. Don't like the idea of swallowing that sort of error, but not sure not-catching is the right answer either. Will give it some further thought...

@jasonrbriggs jasonrbriggs reopened this Jul 11, 2015
@jasonrbriggs
Copy link
Owner

Resolved in version 4.1.6

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

No branches or pull requests

3 participants