Kouhei Sutou
null+****@clear*****
Mon Dec 22 23:58:38 JST 2014
Kouhei Sutou 2014-12-22 23:58:38 +0900 (Mon, 22 Dec 2014) New Revision: 5d75f936fa39fb3164e5d587dd4c7a26c29f1d3d https://github.com/groonga/groonga/commit/5d75f936fa39fb3164e5d587dd4c7a26c29f1d3d Message: mrb: use LoadError for load error Modified files: lib/ctx_impl_mrb.c lib/mrb.c Modified: lib/ctx_impl_mrb.c (+1 -0) =================================================================== --- lib/ctx_impl_mrb.c 2014-12-22 23:46:50 +0900 (253989d) +++ lib/ctx_impl_mrb.c 2014-12-22 23:58:38 +0900 (7c5dd97) @@ -63,6 +63,7 @@ grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx) mrb->ud = ctx; ctx->impl->mrb.module = mrb_define_module(mrb, "Groonga"); + mrb_define_class(mrb, "LoadError", mrb_class_get(mrb, "ScriptError")); mrb_define_method(mrb, mrb->kernel_module, "load", mrb_kernel_load, MRB_ARGS_REQ(1)); Modified: lib/mrb.c (+2 -1) =================================================================== --- lib/mrb.c 2014-12-22 23:46:50 +0900 (e6e573b) +++ lib/mrb.c 2014-12-22 23:58:38 +0900 (c488adf) @@ -27,6 +27,7 @@ #endif #define BUFFER_SIZE 2048 +#define E_LOAD_ERROR (mrb_class_get(mrb, "LoadError")) #ifdef GRN_WITH_MRUBY # ifdef WIN32 @@ -123,7 +124,7 @@ grn_mrb_load(grn_ctx *ctx, const char *path) snprintf(message, BUFFER_SIZE - 1, "fopen: failed to open mruby script file: <%s>", expanded_path); SERR(message); - exception = mrb_exc_new(mrb, E_ARGUMENT_ERROR, + exception = mrb_exc_new(mrb, E_LOAD_ERROR, ctx->errbuf, strlen(ctx->errbuf)); mrb->exc = mrb_obj_ptr(exception); return mrb_nil_value(); -------------- next part -------------- HTML����������������������������... Download