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

Ditch EventEmitter API #33

Open
adborden opened this issue Mar 26, 2015 · 6 comments
Open

Ditch EventEmitter API #33

adborden opened this issue Mar 26, 2015 · 6 comments
Labels

Comments

@adborden
Copy link
Contributor

We don't really document it, but librato-node extends EventEmitter and emits errors in addition to calling the callback.

This is a bit strange because:

  1. It's not documented.
  2. You have to handle the error twice, or at least setup two handlers.

There is only one place where we're actually using emit. Should we just drop the EventEmitter API?

@kevinburkeshyp
Copy link

I'm confused by "handle the error twice", at least if all you are doing is using start, stop and increment() etc, flushing happens in the background and you're not handling it; the only way to handle errors in that case would be with .on('error')

I'd prefer if the worker didn't crash when Librato errored, or for the .on('error') procedure to be highlighted in the README in big red letters.

@adborden
Copy link
Contributor Author

Good point. I was thinking in the manual flush case, you get the error from the callback and the emitter.

If we decide to keep it, I agree that we should document it.

@icodeforlove
Copy link

This one just bit me, there really needs to be documentation on this. Do i understand this correctly, if i have a

liberato.on('error', function() {});

I will no longer have uncaught errors when there are network issues?

@adborden
Copy link
Contributor Author

Yeah, that's right. I just added this to the readme #46

@bobzoller
Copy link
Contributor

thanks @adborden!

On Sun, Aug 9, 2015 at 7:19 PM, Aaron Borden [email protected]
wrote:

Yeah, that's right. I just added this to the readme #46
#46


Reply to this email directly or view it on GitHub
#33 (comment)
.

@timborden
Copy link

Bit me too....thanks @adborden for adding to the docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants