Parse errors from the Powershell Neo4J driver

(Paul Drangeid) #1

I'm able to successfully submit queries via Powershell using the driver, and I am parsing the successful results, however I'm having a little trouble understanding how to parse the $result object when I successfully submit the transaction, but there is a syntax error in the cypher (which then generates a runtime exception in the Neo4j.Driver). I'm NOT getting an error caught by the try/catch on the actual execution of the query:$result = $session.Run($cypher)

I get most of my data from the $result.PSObject.Properties['Summary'].value (and then have to parse it out, as it is one large string).

If I run cypher that has syntax problems I can't parse the $result | ForEach-Object. All I'm looking to do is determine that the syntax failed, and collect the error message so I can log it.

I'm using this to execute cypher code from a powershell script, and log the results into a node (within neo4j) to validate scripts. (this can be used to verify that development hasn't broken something, and that certain script sections are hitting minimum node numbers, etc etc)

I'm very close to having this working, and will post the source code when completed.