lib/json_pointer/evaluator.rb in json_schema-0.11.0 vs lib/json_pointer/evaluator.rb in json_schema-0.12.0
- old
+ new
@@ -14,11 +14,11 @@
if path.empty?
return @data
end
if path[0] != "/"
- raise %{Path must begin with a leading "/": #{original_path}.}
+ raise ArgumentError, %{Path must begin with a leading "/": #{original_path}.}
end
path_parts = split(path)
evaluate_segment(@data, path_parts)
end
@@ -33,10 +33,10 @@
nil
else
key = transform_key(path_parts.shift)
if data.is_a?(Array)
unless key =~ /^\d+$/
- raise %{Key operating on an array must be a digit or "-": #{key}.}
+ raise ArgumentError, %{Key operating on an array must be a digit or "-": #{key}.}
end
evaluate_segment(data[key.to_i], path_parts)
else
evaluate_segment(data[key], path_parts)
end