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

How to handle the errors #333

Closed
Ajido opened this issue Nov 21, 2015 · 2 comments
Closed

How to handle the errors #333

Ajido opened this issue Nov 21, 2015 · 2 comments

Comments

@Ajido
Copy link

Ajido commented Nov 21, 2015

Hi, I have a question about error handling.

I've terminated processes if "error" events occurred. And it is restarted by the upstart, most of the problems were corrected. But those processes had continued to fail without being terminated by "transmissionError" with the code 515.

This problem was fixed by restarting manually, but because I wanted to prevent the recurrence, I modified the code to terminate those processes even when a transmissionError with 515 occurs.

In this case, the above workaround is OK? If there is a better way, please tell me.
I think fatal error should be emitted in the "error" event.

@silentjohnny
Copy link

I'm having the same problem. It would be nice if after failed connection retries the module would emit an 'error' event and not just transmission errors. Listening to 514 transmissionErrors means acting on multiple (possibly thousands) of error events, which is obviously not what you want. Listening to a socketError is also not what you want, because the module might still retry the socket connection.

Isn't there an

this.emit('error', error) 

missing in the module after

this.rejectBuffer(Errors.connectionRetryLimitExceeded);

@argon, Can you explain why an error event is thrown in case of wrong environment but not after failed retries?

@argon
Copy link
Collaborator

argon commented Nov 23, 2015

In addition to being a fatal error, an incorrect environment can guarantee that no notifications have been sent. In the case of a connection timeout it's possible that some notifications were already sent before the connectivity problems started. Because of this it's important that the transmissionError is raised for each notification so that the application can track which notifications were not sent - something many systems are keen to do.

In the case that the retry limit is exceeded it is probably a good idea to emit an error also. I will consider this in future.

@argon argon closed this as completed in 47a63b9 Jan 28, 2016
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