YUKI Hiroshi
null+****@clear*****
Wed Feb 12 19:46:58 JST 2014
YUKI Hiroshi 2014-02-12 19:46:58 +0900 (Wed, 12 Feb 2014) New Revision: f758a441f70ce402b01517dbe6c1d2ff0a0971be https://github.com/droonga/fluent-plugin-droonga/commit/f758a441f70ce402b01517dbe6c1d2ff0a0971be Message: Don't rescue unexpected errors from Catalog::Version1.new Modified files: lib/droonga/catalog_loader.rb Modified: lib/droonga/catalog_loader.rb (+9 -6) =================================================================== --- lib/droonga/catalog_loader.rb 2014-02-12 19:46:15 +0900 (e99114e) +++ lib/droonga/catalog_loader.rb 2014-02-12 19:46:58 +0900 (bfbb4f6) @@ -24,14 +24,17 @@ module Droonga end def load - data = File.open(@path) do |file| - JSON.parse(file.read) + data = nil + begin + data = File.open(@path) do |file| + JSON.parse(file.read) + end + rescue Errno::ENOENT => error + raise Error.new("Missing catalog file #{@path}") + rescue JSON::ParserError => error + raise Error.new("Syntax error in #{@path}:\n#{error.to_s}") end Catalog::Version1.new(data, @path) - rescue Errno::ENOENT => error - raise Error.new("Missing catalog file #{@path}") - rescue JSON::ParserError => error - raise Error.new("Syntax error in #{@path}:\n#{error.to_s}") end end end -------------- next part -------------- HTML����������������������������...Download