Class: FHTTPClient::Processor::Exception

Inherits:
Service
  • Object
show all
Defined in:
lib/f_http_client/processor/exception.rb

Overview

This Service proccess a HTTP exception generating failure result.

Example:

def process

error = Errno::ECONNREFUSED.new('Failed to open TCP connection to :80')
FHTTPClient::Processor::ResponseProcessor.(error: error)
  .on_failure(:connection_refused) {  return 'The server has been refused the connection.' }
  .on_failure { |error_message| return "Generic #{error_message}" }

end

proccess # => ‘The server has been refused the connection.’

Instance Method Summary collapse

Instance Method Details

#runObject



22
23
24
# File 'lib/f_http_client/processor/exception.rb', line 22

def run
  log_data.and_then { Failure(error_name, :exception, data: error) }
end