Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Differentiate between errors that close the connection & not #32

Open
pmenglund opened this Issue · 13 comments

2 participants

@pmenglund

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.

@derekcollison

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

@pmenglund

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

@derekcollison

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

@pmenglund

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

@derekcollison

But isn't that a connect error?

@pmenglund

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)

@derekcollison

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?

@pmenglund

exactamundo :)

@derekcollison

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..

@pmenglund

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

@derekcollison

Where are we on this?

@pmenglund

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

@derekcollison

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.