Module: Rumonade::ErrorHandling

Defined in:
lib/rumonade/error_handling.rb

Overview

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) }

Instance Method Summary collapse

Instance Method Details

#should_reraise?(ex) ⇒ Boolean

Should re-raise exceptions like Interrupt and NoMemoryError by default.

Parameters:

  • ex (Exception)

    the exception to consider re-raising

Returns:

  • (Boolean)

    Returns true if a subclass of StandardError, otherwise false.



60
61
62
63
64
65
# File 'lib/rumonade/error_handling.rb', line 60

def should_reraise?(ex)
  case ex
    when StandardError; false
    else true
  end
end