Module: Toolx::Core::Operation::RescueWrapper

Defined in:
lib/toolx/core/operation/rescue_wrapper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



17
18
19
# File 'lib/toolx/core/operation/rescue_wrapper.rb', line 17

def self.prepended(base)
  base.include ::ActiveSupport::Rescuable
end

Instance Method Details

#perform(*args, **kwargs) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/toolx/core/operation/rescue_wrapper.rb', line 4

def perform(*args, **kwargs)
  if args.present? || kwargs.present?
    super
  else
    super()
  end
rescue => exception
  handler = handler_for_rescue(exception)
  return handler.call(exception) if handler

  raise
end