Class: Jess::HttpClient::ErrorDecorator

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/jess/http_client/error_decorator.rb

Overview

Wraps a Net::HTTP object to provide exception handling around the ‘request` method, such that 400 and 500 error codes are translated into appropriate Jess::HttpClient::Error exceptions.

Instance Method Summary collapse

Instance Method Details

#request(req) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/jess/http_client/error_decorator.rb', line 10

def request(req)
  super.tap do |response|
    raise_if_error_code(response)
  end
rescue StandardError => e
  handle_exception(e, req)
end