Forum: Ruby Rescue error with custom exception

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6c3c7b293087ba9ee03dd03d2697e5b3?d=identicon&s=25 Cirus Polis (ciruspolis)
on 2017-04-29 17:57
I would like to rescue some code with a custom exception class.  Here
some code:

class CustomError < StandardError
end

begin
  'foo'.bar(:baz)
rescue CustomError
  # THIS IS FINE
end

However, my class is not able to rescue the `NoMethodError` exception.

Is there a way to rescue this exception with a custom class such as
`CustomError`?
This topic is locked and can not be replied to.