|
1 | 1 | # frozen_string_literal: false
|
2 |
| -# Net::HTTP exception class. |
3 |
| -# You cannot use Net::HTTPExceptions directly; instead, you must use |
4 |
| -# its subclasses. |
5 |
| -module Net::HTTPExceptions |
6 |
| - def initialize(msg, res) #:nodoc: |
7 |
| - super msg |
8 |
| - @response = res |
| 2 | +module Net |
| 3 | + # Net::HTTP exception class. |
| 4 | + # You cannot use Net::HTTPExceptions directly; instead, you must use |
| 5 | + # its subclasses. |
| 6 | + module HTTPExceptions |
| 7 | + def initialize(msg, res) #:nodoc: |
| 8 | + super msg |
| 9 | + @response = res |
| 10 | + end |
| 11 | + attr_reader :response |
| 12 | + alias data response #:nodoc: obsolete |
9 | 13 | end
|
10 |
| - attr_reader :response |
11 |
| - alias data response #:nodoc: obsolete |
12 |
| -end |
13 |
| -class Net::HTTPError < Net::ProtocolError |
14 |
| - include Net::HTTPExceptions |
15 |
| -end |
16 |
| -class Net::HTTPRetriableError < Net::ProtoRetriableError |
17 |
| - include Net::HTTPExceptions |
18 |
| -end |
19 |
| -class Net::HTTPClientException < Net::ProtoServerError |
20 |
| - include Net::HTTPExceptions |
21 |
| -end |
22 | 14 |
|
23 |
| -# for compatibility |
24 |
| -Net::HTTPServerException = Net::HTTPClientException # :nodoc: |
25 |
| -# We cannot use the name "HTTPServerError", it is the name of the response. |
| 15 | + class HTTPError < ProtocolError |
| 16 | + include HTTPExceptions |
| 17 | + end |
26 | 18 |
|
27 |
| -class Net::HTTPFatalError < Net::ProtoFatalError |
28 |
| - include Net::HTTPExceptions |
29 |
| -end |
| 19 | + class HTTPRetriableError < ProtoRetriableError |
| 20 | + include HTTPExceptions |
| 21 | + end |
30 | 22 |
|
31 |
| -module Net |
| 23 | + class HTTPClientException < ProtoServerError |
| 24 | + include HTTPExceptions |
| 25 | + end |
| 26 | + |
| 27 | + class HTTPFatalError < ProtoFatalError |
| 28 | + include HTTPExceptions |
| 29 | + end |
| 30 | + |
| 31 | + # We cannot use the name "HTTPServerError", it is the name of the response. |
| 32 | + HTTPServerException = HTTPClientException # :nodoc: |
32 | 33 | deprecate_constant(:HTTPServerException)
|
33 | 34 | end
|
0 commit comments