summaryrefslogtreecommitdiff
path: root/lib/chef/monkey_patches/net_http.rb
blob: 07918a8c1fec3a7787156555b6430aa077441ddc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

# Module gets mixed in to Net::HTTP exception classes so we can attach our
# RESTRequest object to them and get the request parameters back out later.
module ChefNetHTTPExceptionExtensions
  attr_accessor :chef_rest_request
end

unless defined?(Net::HTTPClientException)
  Net::HTTPClientException = Net::HTTPServerException
end

require "net/http" unless defined?(Net::HTTP)
module Net
  class HTTPError
    include ChefNetHTTPExceptionExtensions
  end
  class HTTPRetriableError
    include ChefNetHTTPExceptionExtensions
  end
  class HTTPClientException
    include ChefNetHTTPExceptionExtensions
  end
  class HTTPFatalError
    include ChefNetHTTPExceptionExtensions
  end
end