Reputation: 514
I've got a tool I'm working on that parses Neo4j responses and emits objects.
https://github.com/brian-gates/neo4j-stream-deserializer
My questions:
The possible error responses look like this:
{ message: 'Error explanation, ... other useful info ... }
Full example:
https://gist.github.com/brian-gates/4a16e0aee13d6e549d52
With successful responses looking like this:
{ columns: [], results: [] }
https://github.com/brian-gates/neo4j-stream-deserializer/blob/master/test/mock/neo4j_response.json
Upvotes: 1
Views: 1266
Reputation: 33175
Try checking header status. If not 200 OK, don't use the streaming parser, just forward the error to the caller.
It gets more tricky with the transactional cypher endpoint (which responds with 200 if there are errors, because each statement can have separate errors), but with the normal cypher endpoint this should work fine.
Upvotes: 1
Reputation: 192
You might be interested in Oboe.js, a library which I maintain: Oboe.js on Github
Upvotes: 1