[Groonga-commit] droonga/droonga-client-ruby at c783a3a [master] Handle "no response" error

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Apr 15 18:24:46 JST 2015


YUKI Hiroshi	2015-04-15 18:24:46 +0900 (Wed, 15 Apr 2015)

  New Revision: c783a3a7c260391027cc0cc59c07610a6474c1ec
  https://github.com/droonga/droonga-client-ruby/commit/c783a3a7c260391027cc0cc59c07610a6474c1ec

  Message:
    Handle "no response" error

  Modified files:
    bin/droonga-groonga
    bin/droonga-system-status
    lib/droonga/command/base.rb

  Modified: bin/droonga-groonga (+4 -0)
===================================================================
--- bin/droonga-groonga    2015-04-15 18:20:42 +0900 (5757a89)
+++ bin/droonga-groonga    2015-04-15 18:24:46 +0900 (28da8dc)
@@ -49,6 +49,7 @@ module Droonga
         }
 
         response = client.request(groonga_message)
+        raise NoResponse.new unless response
         body = response["body"]
 
         if @options[:pretty]
@@ -61,6 +62,9 @@ module Droonga
       rescue MissingRequiredParameter, InvalidCommandName, MissingCommandName
         puts(@options)
         true
+      rescue NoResponse
+        puts("Error: request timed out.")
+        false
       end
 
       private

  Modified: bin/droonga-system-status (+4 -0)
===================================================================
--- bin/droonga-system-status    2015-04-15 18:20:42 +0900 (a1ad054)
+++ bin/droonga-system-status    2015-04-15 18:24:46 +0900 (c259d4f)
@@ -31,6 +31,7 @@ module Droonga
 
         response = client.request("dataset" => @options[:dataset],
                                   "type"    => "system.status")
+        raise NoResponse.new unless response
         body = response["body"]
 
         if @options[:pretty]
@@ -43,6 +44,9 @@ module Droonga
       rescue MissingRequiredParameter
         puts(@options)
         true
+      rescue NoResponse
+        puts("Error: request timed out.")
+        false
       end
     end
   end

  Modified: lib/droonga/command/base.rb (+3 -0)
===================================================================
--- lib/droonga/command/base.rb    2015-04-15 18:20:42 +0900 (c67d78c)
+++ lib/droonga/command/base.rb    2015-04-15 18:24:46 +0900 (39e71d9)
@@ -24,6 +24,9 @@ module Droonga
     class MissingRequiredParameter < StandardError
     end
 
+    class NoResponse < StandardError
+    end
+
     class Base
       private
       def parse_options(&block)
-------------- next part --------------
HTML����������������������������...
Descargar 



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