Skip to content

Commit

Permalink
Merge pull request #79 from digitalbias/master
Browse files Browse the repository at this point in the history
Fix for issue #78
  • Loading branch information
maxdemarzi committed Feb 1, 2013
2 parents eff6f2a + dc99e62 commit e59ab33
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/neography/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,15 @@ def evaluate_response(response)
end

def handle_4xx_500_response(code, body)
parsed_body = JSON.parse(body)
message = parsed_body["message"]
stacktrace = parsed_body["stacktrace"]
if body.nil? or body == ""
parsed_body = {}
message = "No error message returned from server."
stacktrace = ""
else
parsed_body = JSON.parse(body)
message = parsed_body["message"]
stacktrace = parsed_body["stacktrace"]
end

@logger.error "#{code} error: #{body}" if @log_enabled

Expand Down
10 changes: 10 additions & 0 deletions spec/integration/rest_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@
new_index = @neo.get_relationship_index("test_relationship_index", key, value)
new_index.should be_nil
end

it "throws an error when there is an empty string in the value when removing a node" do
new_node = @neo.create_node
key = generate_text(6)
value = generate_text
@neo.add_node_to_index("test_node_index", key, value, new_node)
new_index = @neo.get_node_index("test_node_index", key, value)
new_index.should_not be_nil
expect { @neo.remove_node_from_index("test_node_index", key, "", new_node) }.to raise_error Neography::NeographyError
end
end

describe "get index" do
Expand Down

0 comments on commit e59ab33

Please sign in to comment.