Navigation Menu

Skip to content

Commit

Permalink
Support GRN_SCORER_ERROR
Browse files Browse the repository at this point in the history
It's introduced since Groonga 5.0.1.
  • Loading branch information
kenhys committed Apr 2, 2015
1 parent bf00415 commit f891320
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 @@ -99,6 +99,7 @@ static VALUE eGrnNormalizerError;
static VALUE eGrnTokenFilterError;
static VALUE eGrnCommandError;
static VALUE eGrnPluginError;
static VALUE eGrnScorerError;

VALUE
rb_grn_rc_to_exception (grn_rc rc)
Expand Down Expand Up @@ -337,6 +338,9 @@ rb_grn_rc_to_exception (grn_rc rc)
case GRN_PLUGIN_ERROR:
exception = eGrnPluginError;
break;
case GRN_SCORER_ERROR:
exception = eGrnScorerError;
break;
}

if (NIL_P(exception))
Expand Down Expand Up @@ -582,6 +586,9 @@ rb_grn_rc_to_message (grn_rc rc)
case GRN_PLUGIN_ERROR:
message = "plugin error";
break;
case GRN_SCORER_ERROR:
message = "scorer error";
break;
}

if (!message)
Expand Down Expand Up @@ -1261,4 +1268,14 @@ rb_grn_init_exception (VALUE mGrn)
*/
eGrnPluginError =
rb_define_class_under(mGrn, "PluginError", rb_eGrnError);

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

Expand Down

0 comments on commit f891320

Please sign in to comment.