Commit f7313b60 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge branch 'fix-type-error-message' of https://github.com/h2so5/mruby into...

Merge branch 'fix-type-error-message' of https://github.com/h2so5/mruby into h2so5-fix-type-error-message
parents cf7fb881 1f571dd5
......@@ -20,7 +20,7 @@ class Array
end
def -(elem)
raise TypeError, "can't convert to Array" unless elem.class == Array
raise TypeError, "can't convert #{elem.class.to_s} into Array" unless elem.class == Array
hash = {}
array = []
......@@ -30,14 +30,14 @@ class Array
end
def |(elem)
raise TypeError, "can't convert to Array" unless elem.class == Array
raise TypeError, "can't convert #{elem.class.to_s} into Array" unless elem.class == Array
ary = self + elem
ary.uniq! or ary
end
def &(elem)
raise TypeError, "can't convert to Array" unless elem.class == Array
raise TypeError, "can't convert #{elem.class.to_s} into Array" unless elem.class == Array
hash = {}
array = []
......
......@@ -305,7 +305,9 @@ convert_type(mrb_state *mrb, mrb_value val, const char *tname, const char *metho
m = mrb_intern(mrb, method);
if (!mrb_respond_to(mrb, val, m)) {
if (raise) {
mrb_raisef(mrb, E_TYPE_ERROR, "can't convert %S into %S", val, mrb_str_new_cstr(mrb, tname));
const char *cname = mrb_obj_classname(mrb, val);
mrb_raisef(mrb, E_TYPE_ERROR, "can't convert %S into %S",
mrb_str_new_cstr(mrb, cname), mrb_str_new_cstr(mrb, tname));
return mrb_nil_value();
}
else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment