Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise HTTP::Request::InvalidURIError for wrong url's #723

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

skatkov
Copy link

@skatkov skatkov commented Aug 13, 2022

Really enjoy using your gem, so decided to study internal of it better.

is there any better way to understand internals, when contributing to gem directly? I guess, not.

This PR addressed an issue that is assigned for 5.0 milestone

closes #565

Comment on lines +157 to +158
rescue Addressable::URI::InvalidURIError => e
raise HTTP::Request::InvalidURIError, e.message
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should move this to HTTP::URI.parse instead? And probably call it HTTP::URI::InvalidError

Comment on lines +228 to +230
raise(InvalidURIError, "empty uri provided") if @uri.host.nil?
raise(UnsupportedMethodError, "unknown method: #{verb}") unless METHODS.include?(@verb)
raise(UnsupportedSchemeError, "unknown scheme: #{scheme}") unless SCHEMES.include?(@scheme)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, all of the above should raise ArgumentError. Please make this method private. Furthermore, what are your thoughts on renaming it to validate!?

@ixti ixti self-requested a review August 14, 2022 23:25
Copy link

@sakshirana1309 sakshirana1309 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a

@ixti ixti self-assigned this Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error messages for invalid URLs
3 participants