Skip to content

Commit

Permalink
vm_insnhelper.c: improved error message for "wrong number
Browse files Browse the repository at this point in the history
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 927e18b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions vm_insnhelper.c
Expand Up @@ -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);
}
Expand Down

0 comments on commit 927e18b

Please sign in to comment.