In following example:
class Foo class MyCustomerror < StandardError def message "My custom error" end end def self.do_standard 1 / 0 rescue StandardError => e puts e.message end def self.do_custom 1 / 0 rescue MyCustomerror => e puts e.message end end I have a problem with call rescue block which params is MyCustomerror. If i call Foo.do_standard, rescue block is called, however when i call Foo.do_custom rescue block with MyCustomerror isn't called. Where is the problem?
rescue MyCustomerrorrescuesMyCustomerrorand its subclasses. ButZeroDivisionErrorisn't one of its subclasses.