Skip to content

Commit

Permalink
vm_eval.c: refine messages
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nobu committed Sep 3, 2015
1 parent 4a14d94 commit e26ba49
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
Thu Sep 3 10:07:49 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>

* vm_eval.c (raise_method_missing): refine error messages when a
symbol is not given. [Fix GH-1013]

Wed Sep 2 18:49:55 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>

* ext/psych/*: merge psych master(8737e5b). It contains following fixes.
Expand Down
9 changes: 7 additions & 2 deletions vm_eval.c
Expand Up @@ -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");

This comment has been minimized.

Copy link
@Bartuz

Bartuz Sep 3, 2015

names should be singular.

rb_raise(rb_eArgError, "no method name 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();
Expand Down

0 comments on commit e26ba49

Please sign in to comment.