[Groonga-commit] droonga/fluent-plugin-droonga at e4c6242 [master] Define error status codes as constants

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Jan 27 17:38:31 JST 2014


YUKI Hiroshi	2014-01-27 17:38:31 +0900 (Mon, 27 Jan 2014)

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

  Message:
    Define error status codes as constants

  Modified files:
    lib/droonga/message_processing_error.rb

  Modified: lib/droonga/message_processing_error.rb (+5 -7)
===================================================================
--- lib/droonga/message_processing_error.rb    2014-01-27 17:31:59 +0900 (084a0c8)
+++ lib/droonga/message_processing_error.rb    2014-01-27 17:38:31 +0900 (301ff13)
@@ -15,6 +15,8 @@
 
 module Droonga
   class MessageProcessingError < StandardError
+    STATUS_CODE = 500.freeze
+
     attr_reader :message, :detail
  
     def initialize(message, detail=nil)
@@ -27,7 +29,7 @@ module Droonga
     end
 
     def status_code
-      500
+      STATUS_CODE
     end
 
     def response_body
@@ -41,14 +43,10 @@ module Droonga
   end
 
   class BadRequest < MessageProcessingError
-    def status_code
-      400
-    end
+    STATUS_CODE = 400.freeze
   end
 
   class NotFound < MessageProcessingError
-    def status_code
-      404
-    end
+    STATUS_CODE = 404.freeze
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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