-
Notifications
You must be signed in to change notification settings - Fork 141
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
emit error
event instead of throw error
#5
Conversation
Right now, zookeeper client does not emit error event directly to the user since just throwing out errors does no good for the user. The correct way to handle those errors are actually described in the comments. The client should disconnect and reconnect again when this kind of error happens. Have you encountered those errors during usage? |
@alexguan I meet the error on my test environment. The test environment network will interrupt random, to mock network instability condition. So I can test my hbase client on the test environment and find out the potential bugs. Because zookeeper client is async, I can't If zk client |
If user not listen the @see http://nodejs.org/docs/latest/api/events.html#events_class_events_eventemitter
|
I understand the problem, however, I do think there is a better way to handle it than emitting error. I'm thinking of disconnecting and reconnecting automatically when those scenarios happen. |
I see. I'm waiting for your implementation. I want to use zk client on my production environment as soon as posible. |
working on it now, will post an update soon |
Cool!
|
Any progress? |
Got stuck with work, will address this soon, hopefully before the weekend. |
I think just emit
error
event is better than throw it onConnectionManager.prototype.onSocketData()
.When network come wrong, the zk response data will fault. And
node-zookeeper-client
throw error when data format incorrect, it will let node process exit.I think use
error
event is better. If use care abouterror
, he will listen theerror
event and reconnect zk server again.@see alibaba/node-hbase-client#22