Skip to content

Commit 6305204

Browse files
committed
[GR-17457] Fix raise exception in coerce_to_failed
PullRequest: truffleruby/2462
2 parents 35a9daa + d3fb85a commit 6305204

File tree

1 file changed

+5
-9
lines changed
  • src/main/ruby/truffleruby/core

1 file changed

+5
-9
lines changed

src/main/ruby/truffleruby/core/type.rb

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ def self.coerce_to(obj, cls, meth)
8989
def self.execute_coerce_to(obj, cls, meth)
9090
begin
9191
ret = obj.__send__(meth)
92-
rescue => orig
93-
coerce_to_failed obj, cls, meth, orig
92+
rescue
93+
coerce_to_failed obj, cls, meth
9494
end
9595

9696
if Primitive.object_kind_of?(ret, cls)
@@ -100,15 +100,11 @@ def self.execute_coerce_to(obj, cls, meth)
100100
end
101101
end
102102

103-
def self.coerce_to_failed(object, klass, method, exc=nil)
103+
def self.coerce_to_failed(object, klass, method)
104104
if Primitive.object_respond_to? object, :inspect, false
105-
raise TypeError,
106-
"Coercion error: #{object.inspect}.#{method} => #{klass} failed",
107-
exc
105+
raise TypeError, "Coercion error: #{object.inspect}.#{method} => #{klass} failed"
108106
else
109-
raise TypeError,
110-
"Coercion error: #{method} => #{klass} failed",
111-
exc
107+
raise TypeError, "Coercion error: #{method} => #{klass} failed"
112108
end
113109
end
114110

0 commit comments

Comments
 (0)