lbdremy / node-httperror

HTTPError class extends Error (stack in). var err = new HTTPError(req,res,message);

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTTPError should expose `response.statusCode` in a separate property

enigmatic00 opened this issue · comments

I have an instance where solr-client (a consumer of node-httperror) returns an error object with the resposne from solr as well as all the other flavor in the error object.

Depending on the type request, the error from solr could be a 400 bad request, or 500 internal server error, and I would like to respond to my consumers as such, however, it is very inconvenient to have to parse the error message to be able to get to the error code when it can easily be exposed as a separate property.

Thanks