Confusing error when forgetting protocol
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 125
- Forks
- 65
- Avg merge
- 6h 4m
- Merged PRs (30d)
- 2
Description
Steps to Reproduce
-
Environment:
gems/ruby-3.3.7@x/gems/uri-1.0.3 -
Steps:
Open an Pry/IRB session.
Run:
URI.parse('www.google.com').class
=> URI::Generic
URI.parse('https://www.google.com').class
=> URI::HTTPS
In my production code, I have
URI.parse('www.google.com').open
=> NoMethodError: private method `open' called for an instance of URI::Generic (NoMethodError)
This got me reading the URI source code.
I think that URI::Generic should implement open as a public method and throw an error that explains the issue if its called.
This cost me over an hour. - it must have caught others.
Otherwise. I will need to write a wrapper for URI.parse.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the URI.parse examples in an IRB or Pry session, then inspect the URI::Generic implementation mentioned by the failing open call. Determine the intended behavior for a URI without a protocol and make completion produce an explanatory error instead of the current confusing NoMethodError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100