module Rumonade::ErrorHandling

Classes representing the components of exception handling. Each class is independently composable. Some example usages:

require "rumonade"
require "uri"

s = "http://"
x1 = catching(URI::InvalidURIError).opt { URI.parse(s) }
x2 = catching(URI::InvalidURIError, NoMethodError).either { URI.parse(s) }

Public Instance Methods

should_reraise?(ex) click to toggle source

Should re-raise exceptions like Interrupt and NoMemoryError by default. @param [Exception] ex the exception to consider re-raising @return [Boolean] Returns true if a subclass of StandardError, otherwise false.

# File lib/rumonade/error_handling.rb, line 60
def should_reraise?(ex)
  case ex
    when StandardError; false
    else true
  end
end