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.
I agree, but could you give me a more concrete example?
concrete example of when I need it or how it should be implemented?
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
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)
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?
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
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
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.