node-jmx
node-jmx copied to clipboard
getAttribute doesn't fire callback if attribute isn't found.
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,
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?
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.
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.
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.