Module: RemoteResource::Rescue

Extended by:
ActiveSupport::Concern
Includes:
ActiveSupport::Rescuable
Included in:
Base
Defined in:
lib/remote_resource/base/rescue.rb

Overview

Methods that help with loading and naming the Base class.

Instance Method Summary collapse

Instance Method Details

#with_error_handling(context = {}) ⇒ Object

Public: Use the with_error_handling method to use the error handling behavior defined in the rescue_from calls on the class. Take a block, whose body will error rescued.

Note that it is typically ‘wrong’ in Ruby to rescue Exception. In this case it is OK because we re raise the error if it is not handled. Inspired by ActiveController. rubocop:disable Lint/RescueException

Returns the last executed statement value.



20
21
22
23
24
# File 'lib/remote_resource/base/rescue.rb', line 20

def with_error_handling(context = {})
  yield
rescue Exception => exception
  rescue_with_handler(exception, context) || raise(exception)
end