From: Douglas Tan Date: 2007-09-16T00:38:43+09:00 Subject: Misleading error message with URI::InvalidURIError ------=_Part_9028_31358782.1189870723132 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline The error message that URI.parse displays when supplied with a uri containing leading/trailing whitespace is misleading. irb(main):001:0> require 'uri' => true irb(main):002:0> URI.parse('http://www.ruby-lang.org ') URI::InvalidURIError: bad URI(is not URI?): http://www.ruby-lang.org from /opt/local/lib/ruby/1.8/uri/common.rb:436:in `split' from /opt/local/lib/ruby/1.8/uri/common.rb:485:in `parse' from (irb):2 from :0 I believe that URI.split has an undocumented precondition on the uri parameter, that it should not contain any whitespace around it. Would a documentation patch be a good idea? Possibly even patching URI.split to match enclosing space(es)? -- Practical_Guile << http://practicalguile.com Clever::Tagline::Pending ------=_Part_9028_31358782.1189870723132 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline The error message that URI.parse displays when supplied with a uri containing leading/trailing whitespace is misleading.

irb(main):001:0> require 'uri'
=> true
irb(main):002:0> URI.parse(' http://www.ruby-lang.org ')
URI::InvalidURIError: bad URI(is not URI?): http://www.ruby-lang.org
        from /opt/local/lib/ruby/1.8/uri/common.rb:436:in `split'
        from /opt/local/lib/ruby/1.8/uri/common.rb:485:in `parse'
        from (irb):2
        from :0

I believe that URI.split has an undocumented precondition on the uri parameter, that it should not contain any whitespace around it. Would a documentation patch be a good idea? Possibly even patching URI.split to match enclosing space(es)?

--
Practical_Guile << http://practicalguile.com
Clever::Tagline::Pending ------=_Part_9028_31358782.1189870723132--