Module: PrelandsRails::AbstractInteractor

Instance Method Summary collapse

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/prelands_rails/concerns/abstract_interactor.rb', line 11

def call
  begin
    act
  rescue ::Interactor::Failure # bad promises
    report_error 'Bad promises: %s' % context.errors, context.to_h
    fail! errors: context.errors
  rescue ::ActiveRecord::RecordNotFound => e
    report_error e.message, context.to_h
    fail! errors: 'not found'
  rescue StandardError => e
    error_handler e, context.to_h
    fail! errors: e.message
    custom_error_handler e
  end
end