From 1fae7c0a69d9f80f843cddcfa03c3ac4b999df48 Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Tue, 29 Dec 2020 19:04:19 +0900 Subject: Refine error message from `mrb_get_arg1` #### Before this patch: ```console $ bin/mruby -e '{}.key?' trace (most recent call last): -e:1: wrong number of arguments (ArgumentError) ``` #### After this patch: ```console $ bin/mruby -e '{}.key?' trace (most recent call last): -e:1: wrong number of arguments (given 0, expected 1) (ArgumentError) ``` --- src/class.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/class.c b/src/class.c index 92b58c3ff..bdf74e718 100644 --- a/src/class.c +++ b/src/class.c @@ -840,7 +840,7 @@ mrb_get_arg1(mrb_state *mrb) array_argv = ARY_PTR(a); } if (argc != 1) { - mrb_raise(mrb, E_ARGUMENT_ERROR, "wrong number of arguments"); + mrb_argnum_error(mrb, argc, 1, 1); } return array_argv[0]; } -- cgit v1.2.3