From 927e18b3701662975182d1c0caeb9477af70817e Mon Sep 17 00:00:00 2001 From: duerst Date: Sat, 24 Oct 2015 03:47:40 +0000 Subject: [PATCH] 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 --- ChangeLog | 6 ++++++ vm_insnhelper.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 30e578818a..cb85a8a900 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Oct 24 12:47:47 2015 Martin Duerst + + * 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 * vm_insnhelper.c: remove the typedef redeclaration of diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 7f4a371423..07b7b02385 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -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); }