Exceptions

Rescue StandardError, Not Exception

Create your custom error from StandardError.

begin
  oh_no!
rescue SpecificError => e
  # handle ...
end

begin
  oh_no!
rescue SpecificError, NoCoffeeError => e
  # handle ...
end

OhNoErrors = [
  SpecificError,
  NoCoffeeError,
  NoFoodError,
  SickError,
]

begin
  oh_no!
rescue *OhNoErrors => e
  # handle ...
end

Exception
  NoMemoryError
  ScriptError
    LoadError
    NotImplementedError
    SyntaxError
  SignalException
    Interrupt
  StandardError
    ArgumentError
    IOError
      EOFError
    IndexError
    LocalJumpError
    NameError
      NoMethodError
    RangeError
      FloatDomainError
    RegexpError
    RuntimeError
    SecurityError
    SystemCallError
    SystemStackError
    ThreadError
    TypeError
    ZeroDivisionError
  SystemExit
  fatal