Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Exception#exception

exc.exception([string]) → an_exception or exc

With no argument, or if the argument is the same as the receiver, return the receiver. Otherwise, create a new exception object of the same class as the receiver, but with a message equal to string.to_str.

See also .exception #detailed_message #full_message #cause also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0