Project

General

Profile

Feature #14688 ยป lib_net_http_exceptions_with_deprecate.patch

unasuke (Yusuke Nakamura), 05/10/2018 03:57 PM

View differences:

lib/net/http/exceptions.rb
20 20
  # We cannot use the name "HTTPServerError", it is the name of the response.
21 21
  include Net::HTTPExceptions
22 22
end
23

  
24
# for compatibility
25
Net::HTTPClientException = Net::HTTPServerException
26

  
23 27
class Net::HTTPFatalError < Net::ProtoFatalError
24 28
  include Net::HTTPExceptions
25 29
end
26 30

  
31
module Net
32
  deprecate_constant(:HTTPServerException)
33
  deprecate_constant(:ProtoServerError)
34
end
test/net/http/test_httpresponse.rb
422 422

  
423 423
    res = Net::HTTPResponse.read_new(io)
424 424
    assert_equal(nil, res.message)
425
    assert_raise Net::HTTPServerException do
425
    assert_raise Net::HTTPClientException do
426 426
      res.error!
427 427
    end
428 428
  end