[Groonga-commit] droonga/fluent-plugin-droonga at 76e5ea3 [master] Define status codes in a shared module

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Feb 17 17:34:56 JST 2014


YUKI Hiroshi	2014-02-17 17:34:56 +0900 (Mon, 17 Feb 2014)

  New Revision: 76e5ea3c64f8df24d6cfd3bbcb9d35f969c04eb0
  https://github.com/droonga/fluent-plugin-droonga/commit/76e5ea3c64f8df24d6cfd3bbcb9d35f969c04eb0

  Message:
    Define status codes in a shared module

  Added files:
    lib/droonga/status_code.rb
  Modified files:
    lib/droonga/message_processing_error.rb
    lib/droonga/output_message.rb
    lib/droonga/replier.rb

  Modified: lib/droonga/message_processing_error.rb (+4 -3)
===================================================================
--- lib/droonga/message_processing_error.rb    2014-02-17 17:28:19 +0900 (6162b25)
+++ lib/droonga/message_processing_error.rb    2014-02-17 17:34:56 +0900 (a6da606)
@@ -14,10 +14,11 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 require "droonga/error"
+require "droonga/status_code"
 
 module Droonga
   class MessageProcessingError < Error
-    STATUS_CODE = 500
+    STATUS_CODE = STATUS_INTERNAL_ERROR
 
     attr_reader :message, :detail
 
@@ -45,10 +46,10 @@ module Droonga
   end
 
   class BadRequest < MessageProcessingError
-    STATUS_CODE = 400
+    STATUS_CODE = STATUS_BAD_REQUEST
   end
 
   class NotFound < MessageProcessingError
-    STATUS_CODE = 404
+    STATUS_CODE = STATUS_NOT_FOUND_REQUEST
   end
 end

  Modified: lib/droonga/output_message.rb (+2 -0)
===================================================================
--- lib/droonga/output_message.rb    2014-02-17 17:28:19 +0900 (ef2538b)
+++ lib/droonga/output_message.rb    2014-02-17 17:34:56 +0900 (290f984)
@@ -13,6 +13,8 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+require "droonga/status_code"
+
 module Droonga
   class OutputMessage
     def initialize(raw_message)

  Modified: lib/droonga/replier.rb (+2 -2)
===================================================================
--- lib/droonga/replier.rb    2014-02-17 17:28:19 +0900 (4ce77a7)
+++ lib/droonga/replier.rb    2014-02-17 17:34:56 +0900 (6bd8099)
@@ -13,10 +13,10 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+require "droonga/status_code"
+
 module Droonga
   class Replier
-    STATUS_OK = 200
-
     def initialize(forwarder)
       @forwarder = forwarder
     end

  Added: lib/droonga/status_code.rb (+23 -0) 100644
===================================================================
--- /dev/null
+++ lib/droonga/status_code.rb    2014-02-17 17:34:56 +0900 (bf02572)
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2014 Droonga Project
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1 as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+module Droonga
+  STATUS_OK             = 200
+  STATUS_BAD_REQUEST    = 400
+  STATUS_NOT_FOUND      = 404
+  STATUS_INTERNAL_ERROR = 500
+end
-------------- next part --------------
HTML����������������������������...
다운로드 



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