Module: Lite::Validation::Validator::Node::Implementation::Helpers::CallForeign

Defined in:
lib/lite/validation/validator/node/implementation/helpers/call_foreign.rb

Class Method Summary collapse

Class Method Details

.call_foreign(result, coordinator, &block) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/lite/validation/validator/node/implementation/helpers/call_foreign.rb', line 10

def self.call_foreign(result, coordinator, &block)
  block.call
rescue Error::Fatal
  raise
rescue StandardError => e
  rescue_execution_error(result, coordinator, e)
end

.rescue_execution_error(result, coordinator, error) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/lite/validation/validator/node/implementation/helpers/call_foreign.rb', line 18

def self.rescue_execution_error(result, coordinator, error)
  error = coordinator.internal_error(
    :execution_error,
    message: error.message, data: { error_class: error.class.name }
  )
  result.refute(error)
end