Difference between Exception.exception and Exception.new

Is there a difference between Exception.exception(…) and
Exception.new(…)? From the documentation, they seem to do exactly the

Almost are the same.
But… Unfortunetly, the developers won’t say explicitly what means the
order of their analysys. Here’s the result.

p (Exception.exception(…) == Exception.new(…)) #==> false

Let’s try to get two instances of the same type:

p (Exception.exception(…).to_s == Exception.new(…).to_s)

May be TRUE? :slight_smile:

Hmmmmm… I tried with Ruby 2.2.3, and

Exception.new == Exception.exception

yielded true.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs