phillro/node-elasticsearch-client

Question about the intention of .on('error'...

Opened this issue · 0 comments

Being new to this library, and saying this in the hope that an outsider's opinion may be useful, I initially expected the .on('error' promises to trap any HTTP 4xx and 5xx error code, in addition to the error codes that the http library throws. I made this assumption because other libraries, such as https://github.com/mikeal/request, behave this way.

It likely is a philosophical belief that @phillro has good reason for choosing. As a hopeful long-term user of this project, though, it would help clean my code significantly if the node-elasticsearch-client library was responsible to interpreting if the ES server gave back a error of any kind (rather than now where server-connection errors land in one area and server-response errors land in another area.)

I would be happy to assemble a list of libraries following different techniques if that would assist this conversation. For example I know the sendgrid-nodejs library recently tweaked their handling of errors to be more inline with perceived standards (see sendgrid/sendgrid-nodejs#67).