philippkueng / node-neo4j

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

handle error on superagent request itself for cypherQuery #44

Closed DrBoolean closed 10 years ago

philippkueng commented 10 years ago

Hi @DrBoolean

What part is this PR covering that isn't already in the default clause of the switch. ....I do agree we could be a more verbose on that end, but was wondering if it wouldn't be better to use the res.error object instead?

DrBoolean commented 10 years ago

We came across this issue where superagent threw an error if we couldn't connect to the db port. We have several connections so when one didn't connect, the whole app died.

The switch caught every response error, but we couldn't get it to catch http errors like the initial connection.

adambaker commented 10 years ago

+1. The switch doesn't handle the case where you get no response at all, and couldn't possibly handle that case. It also raises an error that seems impossible to trap in the client and it crashes our app when it shouldn't crash. . An alternate way to handle that error is to take the error argument as the first parameter in the end callback.

philippkueng commented 10 years ago

Hi @DrBoolean and @adambaker i manually merged your PR into the develop branch, i will therefore close your PR. Thank you and sorry you had to wait such a long time.