Skip to content

Commit

Permalink
Support GRN_PLUGIN_ERROR
Browse files Browse the repository at this point in the history
GitHub: fix #45
  • Loading branch information
Masafumi Yokoyama committed Feb 10, 2015
1 parent c30f03e commit d81abfe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ext/groonga/rb-grn-exception.c
Expand Up @@ -98,6 +98,7 @@ static VALUE eGrnUnsupportedCommandVersion;
static VALUE eGrnNormalizerError;
static VALUE eGrnTokenFilterError;
static VALUE eGrnCommandError;
static VALUE eGrnPluginError;

VALUE
rb_grn_rc_to_exception (grn_rc rc)
Expand Down Expand Up @@ -333,6 +334,9 @@ rb_grn_rc_to_exception (grn_rc rc)
case GRN_COMMAND_ERROR:
exception = eGrnCommandError;
break;
case GRN_PLUGIN_ERROR:
exception = eGrnPluginError;
break;
}

if (NIL_P(exception))
Expand Down Expand Up @@ -575,6 +579,9 @@ rb_grn_rc_to_message (grn_rc rc)
case GRN_COMMAND_ERROR:
message = "command error";
break;
case GRN_PLUGIN_ERROR:
message = "plugin error";
break;
}

if (!message)
Expand Down Expand Up @@ -1244,4 +1251,14 @@ rb_grn_init_exception (VALUE mGrn)
*/
eGrnCommandError =
rb_define_class_under(mGrn, "CommandError", rb_eGrnError);

/*
* Document-class: Groonga::PluginError
*
* It is used when a plugin causes an error.
*
* @since 5.0.0
*/
eGrnPluginError =
rb_define_class_under(mGrn, "PluginError", rb_eGrnError);
}
1 change: 1 addition & 0 deletions test/test-exception.rb
Expand Up @@ -98,6 +98,7 @@ def test_defined
assert_const_defined(Groonga, :NormalizerError)
assert_const_defined(Groonga, :TokenFilterError)
assert_const_defined(Groonga, :CommandError)
assert_const_defined(Groonga, :PluginError)
end
end

Expand Down

0 comments on commit d81abfe

Please sign in to comment.