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

getAttribute doesn't fire callback if attribute isn't found. #8

Open
Setheck opened this issue Jul 15, 2015 · 4 comments
Open

getAttribute doesn't fire callback if attribute isn't found. #8

Setheck opened this issue Jul 15, 2015 · 4 comments

Comments

@Setheck
Copy link

Setheck commented Jul 15, 2015

I'm finding that if i try to retrieve an attribute that doesn't exist, nothing happens. My callback just doesn't fire. Is this by design? It seems like it would make more sense to follow the nodejs callback paradigm where all callbacks fire with error and data parameters instead.

E: I should also mention that the error event doesn't fire in this case either.

Thanks,

@zuazo
Copy link
Owner

zuazo commented Jul 15, 2015

I'm not against adding an err parameter to every callback. But that would mean a big change and it would not be backward compatible.

I don't think I will work on this kind of change shortly, but I'm open to PRs.

Anyway, could you give me a failing example?

@zuazo zuazo added the bug label Jul 18, 2015
@Setheck
Copy link
Author

Setheck commented Mar 9, 2016

Sorry it took me a long time to follow up, but I had a sample that was something like this.

https://gist.github.com/Setheck/b52e8cea4b582c7b08e9

I removed my actual jmx information for obvious reasons,
but my terminal result was something like this

$ node test.js
Running
Connected
$

I was expecting to be able to do some handling when the attribute doesn't exist, but the error never fires, likewise the callback never fires as well. so my client.getAttribute call just falls into the ether.
Thanks,

e: replaced code with gist to make it cleaner.

@davidmorabito
Copy link

Having same issue. When trying to get an attribute that does not exist, nothing happens. I struggled like 2 days until I found out a typo. Probably triggering 'on error' should suffice to handle this scenario properly.

@kdvolder
Copy link

kdvolder commented Aug 3, 2018

but the error never fires

It seems to fire for me just fine. But I still think there should also be a way to detect the error in the callback. Even if it fires, the 'global' error handler doesn't really have the ability to determine reliably which precise operation invocation failed. So all it really is good for is logging some error in a file or console, but its not very well suited to allow to handle the failure of the operation in a more meaningful way.

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

No branches or pull requests

4 participants