philippkueng / node-neo4j

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

Transactional endpoint error handling #48

Open johndoe90 opened 10 years ago

johndoe90 commented 10 years ago

Hi,

as described in the documentation (http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-handling-errors) the server always returns a statuscode of 200 or 201. At the moment only the statuscode determines whether an error occured or not, which is pointless because the server only returns "success". So you should check if the result.body.errors array is empty to verify that no errors occured. Also in the current implementation if the server returns 404, indicating that the transaction doesnt exist, the callback function gets called -> callback(null, false); // Transaction doesn't exist. I think if something went wrong with the transaction its better to pass a new error to the callback.