From cc803ebc5786844b796b4b530b8f81ee9b95d9bf Mon Sep 17 00:00:00 2001 From: Roel van Dijk Date: Mon, 8 Oct 2012 15:10:31 +0200 Subject: [PATCH] Fix Exception matching for pre-1.8 Neo4j. --- lib/neography/connection.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/neography/connection.rb b/lib/neography/connection.rb index 1649ea0..a609891 100644 --- a/lib/neography/connection.rb +++ b/lib/neography/connection.rb @@ -114,13 +114,14 @@ def handle_4xx_response(code, body) case code when 400, 404 case parsed_body["exception"] - when "SyntaxException" ; raise SyntaxException.new(message, code, stacktrace) - when "PropertyValueException" ; raise PropertyValueException.new(message, code, stacktrace) - when "BadInputException" ; raise BadInputException.new(message, code, stacktrace) - when "NodeNotFoundException" ; raise NodeNotFoundException.new(message, code, stacktrace) - when "NoSuchPropertyException" ; raise NoSuchPropertyException.new(message, code, stacktrace) - when "RelationshipNotFoundException" ; raise RelationshipNotFoundException.new(message, code, stacktrace) - when "NotFoundException" ; raise NotFoundException.new(message, code, stacktrace) + when /SyntaxException/ ; raise SyntaxException.new(message, code, stacktrace) + when /this is not a query/ ; raise SyntaxException.new(message, code, stacktrace) + when /PropertyValueException/ ; raise PropertyValueException.new(message, code, stacktrace) + when /BadInputException/ ; raise BadInputException.new(message, code, stacktrace) + when /NodeNotFoundException/ ; raise NodeNotFoundException.new(message, code, stacktrace) + when /NoSuchPropertyException/ ; raise NoSuchPropertyException.new(message, code, stacktrace) + when /RelationshipNotFoundException/ ; raise RelationshipNotFoundException.new(message, code, stacktrace) + when /NotFoundException/ ; raise NotFoundException.new(message, code, stacktrace) else raise NeographyError.new(message, code, stacktrace) end