2015-12-16 05:07:31 +00:00
|
|
|
# frozen_string_literal: false
|
2022-05-21 01:22:54 +09:00
|
|
|
module Net
|
|
|
|
# Net::HTTP exception class.
|
|
|
|
# You cannot use Net::HTTPExceptions directly; instead, you must use
|
|
|
|
# its subclasses.
|
|
|
|
module HTTPExceptions
|
|
|
|
def initialize(msg, res) #:nodoc:
|
|
|
|
super msg
|
|
|
|
@response = res
|
|
|
|
end
|
|
|
|
attr_reader :response
|
|
|
|
alias data response #:nodoc: obsolete
|
2012-05-22 20:36:21 +00:00
|
|
|
end
|
2018-06-06 09:01:04 +00:00
|
|
|
|
2022-05-21 01:22:54 +09:00
|
|
|
class HTTPError < ProtocolError
|
|
|
|
include HTTPExceptions
|
|
|
|
end
|
2018-06-06 09:01:04 +00:00
|
|
|
|
2022-05-21 01:22:54 +09:00
|
|
|
class HTTPRetriableError < ProtoRetriableError
|
|
|
|
include HTTPExceptions
|
|
|
|
end
|
2012-05-22 20:36:21 +00:00
|
|
|
|
2022-05-21 01:22:54 +09:00
|
|
|
class HTTPClientException < ProtoServerError
|
|
|
|
include HTTPExceptions
|
|
|
|
end
|
|
|
|
|
|
|
|
class HTTPFatalError < ProtoFatalError
|
|
|
|
include HTTPExceptions
|
|
|
|
end
|
|
|
|
|
|
|
|
# We cannot use the name "HTTPServerError", it is the name of the response.
|
|
|
|
HTTPServerException = HTTPClientException # :nodoc:
|
2018-06-06 09:01:04 +00:00
|
|
|
deprecate_constant(:HTTPServerException)
|
|
|
|
end
|