philippkueng / node-neo4j

Neo4j REST API wrapper for Node.js
MIT License
211 stars 44 forks source link

Improve Request Error Handling #62

Open elsbree opened 8 years ago

elsbree commented 8 years ago

When a neo4j server is down for whatever reason, this module doesn't handle the ECONNREFUSED error- the entire node process exits, which makes it very difficult to return an error to the client. I'm working on a PR for this, but here's what I'm thinking of doing:

Change request callback arity from function(result) { to function(err, result) { This lets us catch ECONNREFUSED errors before they cause node to exit. I'll also have to handle the case where result is null in all functions that make HTTP requests.