Skip to content

Commit

Permalink
[DOC] Get rid of a RDoc bug
Browse files Browse the repository at this point in the history
RDoc overrides class name by the assigned name unexpectedly when
assigned using a qualified class path.
  • Loading branch information
nobu committed May 23, 2022
1 parent 1aaeb77 commit a7bded0
Show file tree
Hide file tree
Showing 2 changed files with 255 additions and 249 deletions.
53 changes: 27 additions & 26 deletions lib/net/http/exceptions.rb
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
# frozen_string_literal: false
# Net::HTTP exception class.
# You cannot use Net::HTTPExceptions directly; instead, you must use
# its subclasses.
module Net::HTTPExceptions
def initialize(msg, res) #:nodoc:
super msg
@response = res
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
end
attr_reader :response
alias data response #:nodoc: obsolete
end
class Net::HTTPError < Net::ProtocolError
include Net::HTTPExceptions
end
class Net::HTTPRetriableError < Net::ProtoRetriableError
include Net::HTTPExceptions
end
class Net::HTTPClientException < Net::ProtoServerError
include Net::HTTPExceptions
end

# for compatibility
Net::HTTPServerException = Net::HTTPClientException # :nodoc:
# We cannot use the name "HTTPServerError", it is the name of the response.
class HTTPError < ProtocolError
include HTTPExceptions
end

class Net::HTTPFatalError < Net::ProtoFatalError
include Net::HTTPExceptions
end
class HTTPRetriableError < ProtoRetriableError
include HTTPExceptions
end

module Net
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:
deprecate_constant(:HTTPServerException)
end
Loading

0 comments on commit a7bded0

Please sign in to comment.