philippkueng / node-neo4j

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

ListNodeIndexes return value when neo4j has no index. #52

Closed thomas91310 closed 9 years ago

thomas91310 commented 9 years ago

Hey,

Just wondering about listAllIndexes behavior when the GraphDB has no index. Got this error when calling listNodeIndexes:

throw err;
         ^
Error: HTTP Error 204 when listing all indexes.
    at ~/dev/mappingsMMtest/node_modules/node-neo4j/main.js:455:14
    at Request.callback (~/dev/mappingsMMtest/node_modules/node-neo4j/node_modules/superagent/lib/node/index.js:656:3)
    at Request.<anonymous> (~/dev/mappingsMMtest/node_modules/node-neo4j/node_modules/superagent/lib/node/index.js:131:10)
    at Request.EventEmitter.emit (events.js:95:17)
    at ClientRequest.<anonymous> (~/dev/mappingsMMtest/node_modules/node-neo4j/node_modules/superagent/lib/node/index.js:786:12)
    at ClientRequest.EventEmitter.emit (events.js:95:17)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1688:21)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
    at Socket.socketOnData [as ondata] (http.js:1583:20)
    at TCP.onread (net.js:525:27)

Is it something that should be handled by Neo4j ? Is there a reason for this ? Would returning an empty object, "false" or anything that would inform the user that no content was found be better than causing this error ?

If yes, I would be happy to change the listIndexes method and make a pull request.

Thomas

philippkueng commented 9 years ago

Hi Thomas

In short, nope there was no reason for this, this indeed a bug. However @bibby has already a PR #39 which is merged and i'll be releasing a new version of node-neo4j this afternoon with that patch included.

Sorry it took so long for me to reply. Cheers Phil