[Groonga-commit] groonga/groonga at be31c04 [master] grndb: show more error message on Groonga log file open failure

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Nov 13 17:13:29 JST 2017


Kouhei Sutou	2017-11-13 17:13:29 +0900 (Mon, 13 Nov 2017)

  New Revision: be31c043344a79278377fd2d5b6fc3d7944466ba
  https://github.com/groonga/groonga/commit/be31c043344a79278377fd2d5b6fc3d7944466ba

  Message:
    grndb: show more error message on Groonga log file open failure

  Modified files:
    lib/mrb/scripts/command_line/grndb.rb
    test/command_line/suite/grndb/test_check.rb

  Modified: lib/mrb/scripts/command_line/grndb.rb (+5 -3)
===================================================================
--- lib/mrb/scripts/command_line/grndb.rb    2017-11-13 17:00:40 +0900 (3ecbc4c70)
+++ lib/mrb/scripts/command_line/grndb.rb    2017-11-13 17:13:29 +0900 (ca4957572)
@@ -146,9 +146,11 @@ module Groonga
         def check_log_paths
           @log_paths.each do |log_path|
             begin
-              log_file = open(log_path)
-            rescue
-              failed("[#{log_path}] Can't open Groonga log path.")
+              log_file = File.new(log_path)
+            rescue => error
+              message = "[#{log_path}] Can't open Groonga log path: "
+              message << "#{error.class}: #{error.message}"
+              failed(message)
               next
             end
 

  Modified: test/command_line/suite/grndb/test_check.rb (+2 -2)
===================================================================
--- test/command_line/suite/grndb/test_check.rb    2017-11-13 17:00:40 +0900 (70385f1e1)
+++ test/command_line/suite/grndb/test_check.rb    2017-11-13 17:13:29 +0900 (d0338d7f5)
@@ -11,8 +11,8 @@ class TestGrnDBCheck < GroongaTestCase
               "--groonga-log-path", "/nonexistent2")
       end
       assert_equal(<<-MESSAGE, error.error_output)
-[/nonexistent1] Can't open Groonga log path.
-[/nonexistent2] Can't open Groonga log path.
+[/nonexistent1] Can't open Groonga log path: RuntimeError: open
+[/nonexistent2] Can't open Groonga log path: RuntimeError: open
       MESSAGE
     end
 
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20171113/9842d7cd/attachment.htm 



More information about the Groonga-commit mailing list
Back to archive index