Skip to content

Commit

Permalink
maybe easier to follow
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdemarzi committed Aug 31, 2013
1 parent 5a6c8c2 commit 7fe6b95
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions lib/neography/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,13 @@ def handle_4xx_500_response(code, body)

def raise_errors(code, exception, message, stacktrace)
case code
when 400, 404
case exception
when 401
raise UnauthorizedError.new(message, code, stacktrace)
when 409
raise OperationFailureException.new(message, code, stacktrace)
end

case exception
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)
Expand All @@ -172,17 +177,9 @@ def raise_errors(code, exception, message, stacktrace)
when /RelationshipNotFoundException/ ; raise RelationshipNotFoundException.new(message, code, stacktrace)
when /NotFoundException/ ; raise NotFoundException.new(message, code, stacktrace)
when /UniquePathNotUniqueException/ ; raise UniquePathNotUniqueException.new(message, code, stacktrace)
else
raise NeographyError.new(message, code, stacktrace)
end
when 401
raise UnauthorizedError.new(message, code, stacktrace)
when 409
raise OperationFailureException.new(message, code, stacktrace)
else
raise NeographyError.new(message, code, stacktrace)
end

raise NeographyError.new(message, code, stacktrace)
end

def parse_string_options(options)
Expand Down

0 comments on commit 7fe6b95

Please sign in to comment.