Module: MtkFramework::ActiveInteractionConcerns::Interruptable

Extended by:
ActiveSupport::Concern
Includes:
Rescuable
Defined in:
lib/mtk_framework/active_interaction_concerns/interruptable.rb

Instance Method Summary collapse

Methods included from Rescuable

#handle_rescue

Instance Method Details

#interrupt_execute!(*args) ⇒ Object

Raises:

  • (ApplicationInterrupt)


17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mtk_framework/active_interaction_concerns/interruptable.rb', line 17

def interrupt_execute!(*args)
  if args.any?
    if args[0].is_a? ActiveModel::Errors
      errors.merge!(args[0])
    else
      errors.add(args[0], args[1], **(args[2] || {}))
    end
  end

  raise 'interrupt_execute! called without error' if errors.empty?

  raise ApplicationInterrupt
end