[Groonga-commit] groonga/groonga [master] table get: add "[table][get] " prefix to error messages

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Aug 14 18:02:53 JST 2012


Kouhei Sutou	2012-08-14 18:02:53 +0900 (Tue, 14 Aug 2012)

  New Revision: 9f3a441162028a915242652f7f28a50e9b132705
  https://github.com/groonga/groonga/commit/9f3a441162028a915242652f7f28a50e9b132705

  Log:
    table get: add "[table][get] " prefix to error messages

  Copied files:
    test/function/suite/table/get/exist.expected
      (from test/function/suite/table/get.expected)
    test/function/suite/table/get/exist.test
      (from test/function/suite/table/get.test)
  Modified files:
    plugins/table/table.c
  Renamed files:
    test/function/suite/table/get/not_exist.expected
      (from test/function/suite/table/get.expected)
    test/function/suite/table/get/not_exist.test
      (from test/function/suite/table/get.test)

  Modified: plugins/table/table.c (+12 -10)
===================================================================
--- plugins/table/table.c    2012-08-14 16:27:37 +0900 (af4b857)
+++ plugins/table/table.c    2012-08-14 18:02:53 +0900 (7c2a26e)
@@ -442,14 +442,14 @@ command_get_resolve_parameters(grn_ctx *ctx, grn_user_data *user_data,
   table_text = GRN_TEXT_VALUE(VAR(0));
   table_length = GRN_TEXT_LEN(VAR(0));
   if (table_length == 0) {
-    ERR(GRN_INVALID_ARGUMENT, "table isn't specified");
+    ERR(GRN_INVALID_ARGUMENT, "[table][get] table isn't specified");
     return ctx->rc;
   }
 
   *table = grn_ctx_get(ctx, table_text, table_length);
   if (!*table) {
     ERR(GRN_INVALID_ARGUMENT,
-        "table doesn't exist: <%.*s>", table_length, table_text);
+        "[table][get] table doesn't exist: <%.*s>", table_length, table_text);
     return ctx->rc;
   }
 
@@ -461,7 +461,8 @@ command_get_resolve_parameters(grn_ctx *ctx, grn_user_data *user_data,
   case GRN_TABLE_NO_KEY:
     if (key_length) {
       ERR(GRN_INVALID_ARGUMENT,
-          "should not specify key for NO_KEY table: <%.*s>: table: <%.*s>",
+          "[table][get] should not specify key for NO_KEY table: <%.*s>: "
+          "table: <%.*s>",
           key_length, key_text,
           table_length, table_text);
       return ctx->rc;
@@ -471,13 +472,13 @@ command_get_resolve_parameters(grn_ctx *ctx, grn_user_data *user_data,
       *id = grn_atoi(id_text, id_text + id_length, &rest);
       if (rest == id_text) {
         ERR(GRN_INVALID_ARGUMENT,
-            "ID should be a number: <%.*s>: table: <%.*s>",
+            "[table][get] ID should be a number: <%.*s>: table: <%.*s>",
             id_length, id_text,
             table_length, table_text);
       }
     } else {
       ERR(GRN_INVALID_ARGUMENT,
-          "ID isn't specified: table: <%.*s>",
+          "[table][get] ID isn't specified: table: <%.*s>",
           table_length, table_text);
     }
     break;
@@ -487,7 +488,7 @@ command_get_resolve_parameters(grn_ctx *ctx, grn_user_data *user_data,
   case GRN_TABLE_VIEW:
     if (key_length && id_length) {
       ERR(GRN_INVALID_ARGUMENT,
-          "should not specify both key and ID: "
+          "[table][get] should not specify both key and ID: "
           "key: <%.*s>: ID: <%.*s>: table: <%.*s>",
           key_length, key_text,
           id_length, id_text,
@@ -498,7 +499,7 @@ command_get_resolve_parameters(grn_ctx *ctx, grn_user_data *user_data,
       *id = grn_table_get(ctx, *table, key_text, key_length);
       if (!*id) {
         ERR(GRN_INVALID_ARGUMENT,
-            "nonexistent key: <%.*s>: table: <%.*s>",
+            "[table][get] nonexistent key: <%.*s>: table: <%.*s>",
             key_length, key_text,
             table_length, table_text);
       }
@@ -508,19 +509,20 @@ command_get_resolve_parameters(grn_ctx *ctx, grn_user_data *user_data,
         *id = grn_atoi(id_text, id_text + id_length, &rest);
         if (rest == id_text) {
           ERR(GRN_INVALID_ARGUMENT,
-              "ID should be a number: <%.*s>: table: <%.*s>",
+              "[table][get] ID should be a number: <%.*s>: table: <%.*s>",
               id_length, id_text,
               table_length, table_text);
         }
       } else {
         ERR(GRN_INVALID_ARGUMENT,
-            "key nor ID isn't specified: table: <%.*s>",
+            "[table][get] key nor ID isn't specified: table: <%.*s>",
             table_length, table_text);
       }
     }
     break;
   default:
-    ERR(GRN_INVALID_ARGUMENT, "not a table: <%.*s>", table_length, table_text);
+    ERR(GRN_INVALID_ARGUMENT,
+        "[table][get] not a table: <%.*s>", table_length, table_text);
     break;
   }
 

  Copied: test/function/suite/table/get/exist.expected (+0 -0) 100%
===================================================================

  Copied: test/function/suite/table/get/exist.test (+0 -0) 100%
===================================================================

  Renamed: test/function/suite/table/get/not_exist.expected (+6 -26) 53%
===================================================================
--- test/function/suite/table/get.expected    2012-08-14 16:27:37 +0900 (2f4abaa)
+++ test/function/suite/table/get/not_exist.expected    2012-08-14 18:02:53 +0900 (0ff162d)
@@ -11,35 +11,15 @@ load --table Diaries
 {"_key":"2012-08-14", "title": "'get' command is moved!", "tags": ["groonga", "development"]},
 ]
 [[0,0.0,0.0],1]
-get Diaries '2012-08-14' 'title, _key, tags'
+get Diaries 'nonexistent'
 [
   [
-    0,
-    0.0,
-    0.0
-  ],
-  [
     [
-      [
-        "title",
-        "ShortText"
-      ],
-      [
-        "_key",
-        "ShortText"
-      ],
-      [
-        "tags",
-        "ShortText"
-      ]
+      -22,
+      0.0,
+      0.0
     ],
-    [
-      "'get' command is moved!",
-      "2012-08-14",
-      [
-        "groonga",
-        "development"
-      ]
-    ]
+    "[table][get] nonexistent key: <nonexistent>: table: <Diaries>"
   ]
 ]
+#|e| [table][get] nonexistent key: <nonexistent>: table: <Diaries>

  Renamed: test/function/suite/table/get/not_exist.test (+1 -1) 86%
===================================================================
--- test/function/suite/table/get.test    2012-08-14 16:27:37 +0900 (4c1facc)
+++ test/function/suite/table/get/not_exist.test    2012-08-14 18:02:53 +0900 (3a408df)
@@ -7,4 +7,4 @@ load --table Diaries
 [
 {"_key":"2012-08-14", "title": "'get' command is moved!", "tags": ["groonga", "development"]},
 ]
-get Diaries '2012-08-14' 'title, _key, tags'
+get Diaries 'nonexistent'
-------------- next part --------------
HTML����������������������������...
다운로드 



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