Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Errors

rdvdijk edited this page · 3 revisions

The REST API returns response codes in the 400-410 range whenever something goes wrong. (See the Neo4j documentation)

The following errors can be thrown:

  • Neography::UnauthorizedError, HTTP Authentication error
  • Neography::NodeNotFoundException, a node could not be found
  • Neography::OperationFailureException, a node cannot be deleted because it has relationships
  • Neography::PropertyValueException, properties can not be null
  • Neography::NoSuchPropertyException, trying to a delete a property that does not exist
  • Neography::RelationshipNotFoundException, a relationship could not be found
  • Neography::BadInputException, error during valid Cypher query
  • Neography::SyntaxException, invalid Cypher query syntax
  • Neography::NotFoundException, a path could not be found by node traversal

All of these errors inherit from Neography::NeographyError, rescue them all as follows:

begin

  @neo = Neography::Rest.new

  # Neography code, for example:
  @neo.get_node(42) # non-existent node id

rescue Neography::NeographyError => err
  puts err.message     # Neo4j error message
  puts err.code        # HTTP error code
  puts err.stacktrace  # Neo4j Java stacktrace
end
Something went wrong with that request. Please try again.