[Groonga-commit] droonga/fluent-plugin-droonga at 8ff90df [master] Handle HandlerError on the plugin layer

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Dec 26 12:47:18 JST 2013


YUKI Hiroshi	2013-12-26 12:47:18 +0900 (Thu, 26 Dec 2013)

  New Revision: 8ff90dfb62578e61447465905f2fe4103782280b
  https://github.com/droonga/fluent-plugin-droonga/commit/8ff90dfb62578e61447465905f2fe4103782280b

  Message:
    Handle HandlerError on the plugin layer

  Modified files:
    lib/droonga/handler_plugin.rb
    lib/droonga/plugin.rb

  Modified: lib/droonga/handler_plugin.rb (+10 -0)
===================================================================
--- lib/droonga/handler_plugin.rb    2013-12-26 12:13:56 +0900 (f621cd2)
+++ lib/droonga/handler_plugin.rb    2013-12-26 12:47:18 +0900 (2f4b185)
@@ -16,6 +16,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 require "droonga/plugin"
+require "droonga/handler_error"
 
 module Droonga
   class HandlerPlugin < Plugin
@@ -30,5 +31,14 @@ module Droonga
     def prefer_synchronous?(command)
       false
     end
+
+    private
+    def run_command(command, message, messanger)
+      begin
+        super
+      rescue HandlerError => error
+        messenger.error(error.status_code, error.response_body)
+      end
+    end
   end
 end

  Modified: lib/droonga/plugin.rb (+6 -1)
===================================================================
--- lib/droonga/plugin.rb    2013-12-26 12:13:56 +0900 (0745e5f)
+++ lib/droonga/plugin.rb    2013-12-26 12:47:18 +0900 (f5e0cbd)
@@ -33,11 +33,16 @@ module Droonga
     end
 
     def process(command, *arguments)
-      __send__(self.class.method_name(command), *arguments)
+      run_command(command, *arguments)
     rescue => exception
       Logger.error("error while processing #{command}",
                    exception,
                    arguments: arguments)
     end
+    
+    private
+    def run_command(command, *arguments)
+      __send__(self.class.method_name(command), *arguments)
+    end
   end
 end
-------------- next part --------------
HTML����������������������������...
下载 



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