Module: Bramble::ErrorHandling

Defined in:
lib/bramble/error_handling.rb

Class Method Summary collapse

Class Method Details

.rescuing(implementation) ⇒ Object

If an error is raised during the block, pass it to the implementation’s ‘on_error` function.



5
6
7
8
9
10
11
12
13
# File 'lib/bramble/error_handling.rb', line 5

def self.rescuing(implementation)
  yield
rescue StandardError => err
  if implementation.respond_to?(:on_error)
    implementation.on_error(err)
  else
    raise(err)
  end
end