-
Notifications
You must be signed in to change notification settings - Fork 133
Errors
rdvdijk edited this page Sep 28, 2012
·
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