summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-03 01:07:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-03 01:07:52 +0000
commite26ba49bd15079b5567048ef1714c2b6d1719eee (patch)
tree1b51547b40e6ca6ad5100565a6e8f49a20954b02 /vm_eval.c
parent4a14d94418dc50b817e4e5811c822a3a07584acf (diff)
vm_eval.c: refine messages
* vm_eval.c (raise_method_missing): refine error messages when a symbol is not given. [Fix GH-1013] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 00b47e5..e12006a 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -693,8 +693,13 @@ raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv, VALUE obj,
VALUE exc = rb_eNoMethodError;
const char *format = 0;
- if (argc == 0 || !SYMBOL_P(argv[0])) {
- rb_raise(rb_eArgError, "no id given");
+ if (UNLIKELY(argc == 0)) {
+ rb_raise(rb_eArgError, "no method names given");
+ }
+ else if (UNLIKELY(!SYMBOL_P(argv[0]))) {
+ const VALUE e = rb_eArgError; /* TODO: TypeError? */
+ rb_raise(e, "method name must be a Symbol but %"PRIsVALUE" is given",
+ rb_obj_class(argv[0]));
}
stack_check();