Differentiate between errors that close the connection & not #32

Closed
pmenglund opened this Issue Jan 31, 2012 · 14 comments

Comments

Projects
None yet
3 participants

There is no difference between a NATS::ServerError that closes the connection (like AUTH_REQUIRED) and one that keeps the connection open - this makes it hard to deal with this on the client side.

It would be nice to have something like NATS::ServerError::Fatal that means the client has to retry the connection.

Owner

derekcollison commented Jan 31, 2012

I agree, but could you give me a more concrete example?

concrete example of when I need it or how it should be implemented?

Owner

derekcollison commented Jan 31, 2012

An example of what is not doing what you want, I can handle the impl.. ;)

whenever the server calls error_close the client should get NATS::ServerError::Fatal so it can reconnect

Owner

derekcollison commented Jan 31, 2012

But isn't that a connect error?

hmm... in the case of AUTH_REQUIRED it is a connect error, but for something like PAYLOAD_TOO_BIG it isn't a connection error, but you get your connection chopped off too (unless you consider anything that requires a reconnect a connection error)

Owner

derekcollison commented Jan 31, 2012

So just so I am understanding, you want anything that terminates a connection to be the same error type so you can swithc on it? Correct?

exactamundo :)

Owner

derekcollison commented Feb 1, 2012

But there are different reasons as to why the connection was terminated, but I will take a look and try to make sense of it..

you can use the same class, but the reason could be in the message, or go for something fancier with more sub-classes for the ConnectionError

Owner

derekcollison commented Apr 30, 2012

Where are we on this?

You said that you'd look into figuring out how to group all events that terminate the connection into some kind of class hierarchy together, so it is easy to catch them and restart the connection

Owner

derekcollison commented Jul 27, 2013

Ping.. I have not done anything specific, keep open?

Closing due to age. If anyone thinks this is still an issue, please let us know.

mcqueary closed this Mar 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment