module Http::Exceptions

Constants

EXCEPTIONS
VERSION

Public Class Methods

check_response!(res) click to toggle source
# File lib/http/exceptions.rb, line 30
def self.check_response!(res)
  raise HttpException.new(response: res) unless (200...300).include?(res.code)
  res
end
wrap_and_check() { || ... } click to toggle source
# File lib/http/exceptions.rb, line 35
def self.wrap_and_check
  wrap_exception do
    check_response! yield
  end
end
wrap_exception() { || ... } click to toggle source
# File lib/http/exceptions.rb, line 22
def self.wrap_exception
  begin
    yield
  rescue *Exceptions::EXCEPTIONS => e
    raise HttpException.new original_exception: e
  end
end