Skip to content

Commit c556ff8

Browse files
authored
Merge pull request #7777 from k77ch7/ruby-3.1-fix-try_convert-message
fix try_convert error message
2 parents 5a8925e + c0eafcc commit c556ff8

File tree

5 files changed

+2
-6
lines changed

5 files changed

+2
-6
lines changed

core/src/main/java/org/jruby/util/TypeConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public static IRubyObject convertToTypeWithCheck(IRubyObject obj, RubyClass targ
225225
IRubyObject val = convertToType(obj, target, convertMethod, false);
226226
if (val.isNil()) return val;
227227
if (!target.isInstance(val)) {
228-
throw newTypeError(obj, target, convertMethod, val);
228+
throw newTypeErrorMismatch(obj.getRuntime(), obj, target, convertMethod, val);
229229
}
230230
return val;
231231
}
@@ -244,7 +244,7 @@ public static IRubyObject convertToTypeWithCheck(ThreadContext context, IRubyObj
244244
IRubyObject val = convertToType(context, obj, target, sites, false);
245245
if (val == context.nil) return val;
246246
if (!target.isInstance(val)) {
247-
throw newTypeError(context.runtime, obj, target, sites.methodName, val);
247+
throw newTypeErrorMismatch(context.runtime, obj, target, sites.methodName, val);
248248
}
249249
return val;
250250
}

spec/tags/ruby/core/array/try_convert_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

spec/tags/ruby/core/hash/try_convert_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

spec/tags/ruby/core/regexp/try_convert_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

spec/tags/ruby/core/string/try_convert_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)