summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--lib/net/http/exceptions.rb8
-rw-r--r--test/net/http/test_httpresponse.rb2
3 files changed, 14 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index f07d60815c..b1731c10b5 100644
--- a/NEWS
+++ b/NEWS
@@ -159,6 +159,11 @@ with all sufficient information, see the ChangeLog file or Redmine
* Add Net::BufferedIO#write_timeout, Net::BufferedIO#write_timeout=,
Net::HTTP#write_timeout, and Net::HTTP#write_timeout=. [Feature #13396]
+ * New constant:
+
+ * Add Net::HTTPClientException to deprecate Net::HTTPServerException,
+ whose name is misleading. [Bug #14688]
+
* REXML
* Improved some XPath implementations:
diff --git a/lib/net/http/exceptions.rb b/lib/net/http/exceptions.rb
index 0d34526616..933cd64ace 100644
--- a/lib/net/http/exceptions.rb
+++ b/lib/net/http/exceptions.rb
@@ -20,7 +20,15 @@ class Net::HTTPServerException < Net::ProtoServerError
# We cannot use the name "HTTPServerError", it is the name of the response.
include Net::HTTPExceptions
end
+
+# for compatibility
+Net::HTTPClientException = Net::HTTPServerException
+
class Net::HTTPFatalError < Net::ProtoFatalError
include Net::HTTPExceptions
end
+module Net
+ deprecate_constant(:HTTPServerException)
+ deprecate_constant(:ProtoServerError)
+end
diff --git a/test/net/http/test_httpresponse.rb b/test/net/http/test_httpresponse.rb
index d99c3611c5..29c38b2bc0 100644
--- a/test/net/http/test_httpresponse.rb
+++ b/test/net/http/test_httpresponse.rb
@@ -422,7 +422,7 @@ EOS
res = Net::HTTPResponse.read_new(io)
assert_equal(nil, res.message)
- assert_raise Net::HTTPServerException do
+ assert_raise Net::HTTPClientException do
res.error!
end
end