[Groonga-commit] droonga/fluent-plugin-droonga at 65a5c27 [master] Add "Parameter" suffix for "MissingXXX" errors

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Dec 26 15:12:52 JST 2013


YUKI Hiroshi	2013-12-26 15:12:52 +0900 (Thu, 26 Dec 2013)

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

  Message:
    Add "Parameter" suffix for "MissingXXX" errors

  Modified files:
    lib/droonga/dispatcher.rb
    lib/droonga/plugin/handler/add.rb
    test/command/suite/add/missing-key.expected
    test/command/suite/add/missing-table.expected
    test/command/suite/message/error/missing-dataset.expected

  Modified: lib/droonga/dispatcher.rb (+2 -2)
===================================================================
--- lib/droonga/dispatcher.rb    2013-12-26 15:10:00 +0900 (98167f5)
+++ lib/droonga/dispatcher.rb    2013-12-26 15:12:52 +0900 (27a1c59)
@@ -32,7 +32,7 @@ module Droonga
   class Dispatcher
     attr_reader :name
 
-    class MissingDataset < BadRequest
+    class MissingDatasetParameter < BadRequest
       def initialize
         super("\"dataset\" must be specified.")
       end
@@ -195,7 +195,7 @@ module Droonga
     end
 
     def assert_valid_message
-      raise MissingDataset.new unles****@messa*****?("dataset")
+      raise MissingDatasetParameter.new unles****@messa*****?("dataset")
     end
 
     def log_tag

  Modified: lib/droonga/plugin/handler/add.rb (+6 -4)
===================================================================
--- lib/droonga/plugin/handler/add.rb    2013-12-26 15:10:00 +0900 (78fcd82)
+++ lib/droonga/plugin/handler/add.rb    2013-12-26 15:12:52 +0900 (7691249)
@@ -24,13 +24,13 @@ module Droonga
   class AddHandler < Droonga::HandlerPlugin
     repository.register("add", self)
 
-    class MissingTable < BadRequest
+    class MissingTableParameter < BadRequest
       def initialize
         super("\"table\" must be specified.")
       end
     end
 
-    class MissingPrimaryKey < BadRequest
+    class MissingPrimaryKeyParameter < BadRequest
       def initialize(table_name)
         super("\"key\" must be specified. " +
                 "The table #{table_name.inspect} requires a primary key for a new record.")
@@ -55,13 +55,15 @@ module Droonga
 
     private
     def process_add(request)
-      raise MissingTable.new unless request.include?("table")
+      raise MissingTableParameter.new unless request.include?("table")
 
       table = @context[request["table"]]
       raise UnknownTable.new(request["table"]) unless table
 
       if table.support_key?
-        raise MissingPrimaryKey.new(request["table"]) unless request.include?("key")
+        unless request.include?("key")
+          raise MissingPrimaryKeyParameter.new(request["table"])
+        end
         table.add(request["key"], request["values"])
       else
         table.add(request["values"])

  Modified: test/command/suite/add/missing-key.expected (+1 -1)
===================================================================
--- test/command/suite/add/missing-key.expected    2013-12-26 15:10:00 +0900 (194722a)
+++ test/command/suite/add/missing-key.expected    2013-12-26 15:12:52 +0900 (eaedfe2)
@@ -6,7 +6,7 @@
     "statusCode": 400,
     "type": "add.result",
     "body": {
-      "name": "MissingPrimaryKey",
+      "name": "MissingPrimaryKeyParameter",
       "message": "\"key\" must be specified. The table \"User\" requires a primary key for a new record."
     }
   }

  Modified: test/command/suite/add/missing-table.expected (+1 -1)
===================================================================
--- test/command/suite/add/missing-table.expected    2013-12-26 15:10:00 +0900 (e7839bf)
+++ test/command/suite/add/missing-table.expected    2013-12-26 15:12:52 +0900 (25d7405)
@@ -6,7 +6,7 @@
     "statusCode": 400,
     "type": "add.result",
     "body": {
-      "name": "MissingTable",
+      "name": "MissingTableParameter",
       "message": "\"table\" must be specified."
     }
   }

  Modified: test/command/suite/message/error/missing-dataset.expected (+1 -1)
===================================================================
--- test/command/suite/message/error/missing-dataset.expected    2013-12-26 15:10:00 +0900 (7e65e1c)
+++ test/command/suite/message/error/missing-dataset.expected    2013-12-26 15:12:52 +0900 (89e0f76)
@@ -6,7 +6,7 @@
     "statusCode": 400,
     "type": "add.result",
     "body": {
-      "name": "MissingDataset",
+      "name": "MissingDatasetParameter",
       "message": "\"dataset\" must be specified."
     }
   }
-------------- next part --------------
HTML����������������������������...
Download 



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