lib/ftw/http/message.rb in ftw-0.0.47 vs lib/ftw/http/message.rb in ftw-0.0.48
- old
+ new
@@ -19,10 +19,13 @@
attr_accessor :version
# HTTP Versions that are valid.
VALID_VERSIONS = [1.0, 1.1]
+ # For backward-compatibility, this exception inherits from ArgumentError
+ UnsupportedHTTPVersion = Class.new(ArgumentError)
+
private
# A new HTTP message.
def initialize
@headers = FTW::HTTP::Headers.new
@@ -99,10 +102,10 @@
def version=(ver)
# Accept string "1.0" or simply "1", etc.
ver = ver.to_f if !ver.is_a?(Float)
if !VALID_VERSIONS.include?(ver)
- raise ArgumentError.new("#{self.class.name}#version = #{ver.inspect} is" \
+ raise UnsupportedHTTPVersion.new("#{self.class.name}#version = #{ver.inspect} is" \
"invalid. It must be a number, one of #{VALID_VERSIONS.join(", ")}")
end
@version = ver
end # def version=