[Groonga-commit] groonga/groonga at 5f7ef02 [master] mrb: add missing RC handling

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Fri May 13 17:29:41 JST 2016


Kouhei Sutou	2016-05-13 17:29:41 +0900 (Fri, 13 May 2016)

  New Revision: 5f7ef02c089b75cf12aadebc420fad6f36467130
  https://github.com/groonga/groonga/commit/5f7ef02c089b75cf12aadebc420fad6f36467130

  Message:
    mrb: add missing RC handling

  Modified files:
    lib/mrb/mrb_ctx.c

  Modified: lib/mrb/mrb_ctx.c (+34 -3)
===================================================================
--- lib/mrb/mrb_ctx.c    2016-05-13 16:28:37 +0900 (228e4c6)
+++ lib/mrb/mrb_ctx.c    2016-05-13 17:29:41 +0900 (b3d278c)
@@ -258,7 +258,7 @@ grn_mrb_ctx_check(mrb_state *mrb)
   grn_ctx *ctx = (grn_ctx *)mrb->ud;
   grn_mrb_data *data = &(ctx->impl->mrb);
   struct RClass *module = data->module;
-  struct RClass *error_class;
+  struct RClass *error_class = NULL;
 #define MESSAGE_SIZE 4096
   char message[MESSAGE_SIZE];
 
@@ -705,12 +705,43 @@ grn_mrb_ctx_check(mrb_state *mrb)
                  "normalizer error: <%s>(%d)",
                  ctx->errbuf, ctx->rc);
     break;
-  default:
+  case GRN_TOKEN_FILTER_ERROR:
+    error_class = mrb_class_get_under(mrb, module, "TokenFilterError");
+    grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+                 "token filter error: <%s>(%d)",
+                 ctx->errbuf, ctx->rc);
+    break;
+  case GRN_COMMAND_ERROR:
+    error_class = mrb_class_get_under(mrb, module, "CommandError");
+    grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+                 "command error: <%s>(%d)",
+                 ctx->errbuf, ctx->rc);
+    break;
+  case GRN_PLUGIN_ERROR:
+    error_class = mrb_class_get_under(mrb, module, "PluginError");
+    grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+                 "plugin error: <%s>(%d)",
+                 ctx->errbuf, ctx->rc);
+    break;
+  case GRN_SCORER_ERROR:
+    error_class = mrb_class_get_under(mrb, module, "ScorerError");
+    grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+                 "scorer error: <%s>(%d)",
+                 ctx->errbuf, ctx->rc);
+    break;
+  case GRN_CANCEL:
+    error_class = mrb_class_get_under(mrb, module, "Cancel");
+    grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
+                 "cancel: <%s>(%d)",
+                 ctx->errbuf, ctx->rc);
+    break;
+  }
+
+  if (!error_class) {
     error_class = mrb_class_get_under(mrb, module, "Error");
     grn_snprintf(message, MESSAGE_SIZE, MESSAGE_SIZE,
                  "unsupported error: <%s>(%d)",
                  ctx->errbuf, ctx->rc);
-    break;
   }
 #undef MESSAGE_SIZE
 
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る