Kouhei Sutou
null+****@clear*****
Wed Jan 13 17:18:35 JST 2016
Kouhei Sutou 2012-11-27 17:46:54 +0900 (Tue, 27 Nov 2012) New Revision: 0ef667c60be305b6dd2b4260c49aaa816c529ca7 https://github.com/groonga/groonga-command/commit/0ef667c60be305b6dd2b4260c49aaa816c529ca7 Message: Wrap Yajl::ParseError Modified files: lib/groonga/command/parser.rb Modified: lib/groonga/command/parser.rb (+14 -4) =================================================================== --- lib/groonga/command/parser.rb 2012-11-27 17:28:32 +0900 (705d137) +++ lib/groonga/command/parser.rb 2012-11-27 17:46:54 +0900 (0a715b7) @@ -217,14 +217,12 @@ module Groonga end end @buffer = rest - @command.original_source << json - @json_parser << json + parse_json(json) if separator.empty? throw(tag) else - @command.original_source << separator @load_value_completed = false - @json_parser << separator + parse_json(separator) end else spaces, start_json, rest =****@buffe*****("[") @@ -248,6 +246,18 @@ module Groonga end end + def parse_json(json) + @command.original_source << json + begin + @json_parser << json + rescue Yajl::ParseError + message = "Invalid JSON: #{$!.message}: <#{json}>:\n" + message << @command.original_source + raise ParseError.new(message) + else + end + end + def consume_line(tag) current_line, separator, rest =****@buffe*****(/\r?\n/) throw(tag) if separator.empty? -------------- next part -------------- HTML����������������������������... Télécharger