Skip to content
Permalink
Browse files
vm_insnhelper.c: improved error message for "wrong number
of arguments", distinguishing given and expected argument
numbers clearly. [Feature #9025]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
duerst committed Oct 24, 2015
1 parent 05b18ac commit 927e18b3701662975182d1c0caeb9477af70817e
Showing with 9 additions and 3 deletions.
  1. +6 −0 ChangeLog
  2. +3 −3 vm_insnhelper.c
@@ -1,3 +1,9 @@
Sat Oct 24 12:47:47 2015 Martin Duerst <duerst@it.aoyama.ac.jp>

* vm_insnhelper.c: improved error message for "wrong number
of arguments", distinguishing given and expected argument
numbers clearly. [Feature #9025]

Sat Oct 24 11:57:59 2015 Shugo Maeda <shugo@ruby-lang.org>

* vm_insnhelper.c: remove the typedef redeclaration of
@@ -216,13 +216,13 @@ rb_arity_error_new(int argc, int min, int max)
{
VALUE err_mess = 0;
if (min == max) {
err_mess = rb_sprintf("wrong number of arguments (%d for %d)", argc, min);
err_mess = rb_sprintf("wrong number of arguments (given %d, expected %d)", argc, min);
}
else if (max == UNLIMITED_ARGUMENTS) {
err_mess = rb_sprintf("wrong number of arguments (%d for %d+)", argc, min);
err_mess = rb_sprintf("wrong number of arguments (given %d, expected %d+)", argc, min);
}
else {
err_mess = rb_sprintf("wrong number of arguments (%d for %d..%d)", argc, min, max);
err_mess = rb_sprintf("wrong number of arguments (given %d, expected %d..%d)", argc, min, max);
}
return rb_exc_new3(rb_eArgError, err_mess);
}

0 comments on commit 927e18b

Please sign in to comment.