Skip to content

Commit f49bbee

Browse files
committed
Update exception message to match MRI.
1 parent c6c6014 commit f49bbee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/ruby/core/type.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def self.rb_check_convert_type(obj, cls, meth)
277277
v = convert_type(obj, cls, meth, false)
278278
return nil if v.nil?
279279
unless object_kind_of?(v, cls)
280-
raise TypeError, "Coercion error: obj.#{meth} did NOT return a #{cls} (was #{object_class(v)})"
280+
raise TypeError, "can't convert #{obj.class} to #{cls} (#{obj.class}##{meth} gives #{v.class})"
281281
end
282282
v
283283
end
@@ -286,7 +286,7 @@ def self.rb_convert_type(obj, cls, meth)
286286
return obj if object_kind_of?(obj, cls)
287287
v = convert_type(obj, cls, meth, true)
288288
unless object_kind_of?(v, cls)
289-
raise TypeError, "Coercion error: obj.#{meth} did NOT return a #{cls} (was #{object_class(v)})"
289+
raise TypeError, "can't convert #{obj.class} to #{cls} (#{obj.class}##{meth} gives #{v.class})"
290290
end
291291
v
292292
end

0 commit comments

Comments
 (0)