Module: Riaction::ApiFailure

Included in:
EventPerformer, ProfileCreator
Defined in:
lib/riaction/api_failure.rb

Instance Method Summary collapse

Instance Method Details

#default_behavior(exception) ⇒ Object



17
18
19
# File 'lib/riaction/api_failure.rb', line 17

def default_behavior(exception)
  raise exception
end

#handle_api_failure(exception) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/riaction/api_failure.rb', line 3

def handle_api_failure(exception)
  if @api_failure_handler_block
    @api_failure_handler_block.call(exception)
  else
    default_behavior(exception)
  end
end

#handle_api_failure_with(&block) ⇒ Object



11
12
13
14
15
# File 'lib/riaction/api_failure.rb', line 11

def handle_api_failure_with(&block)
  if block_given?
    @api_failure_handler_block = block
  end
end