rikkimax / alphaPhobos

Assume License: Boost
11 stars 1 forks source link

uri: 'out bool malformed' #5

Closed dhasenan closed 8 years ago

dhasenan commented 8 years ago

The method in uri to get a URL's scheme takes an out parameter that is set if the input is a malformed URL. Consistency is key. That pattern should either be replicated on all parsing methods or absent from all of them.

dhasenan commented 8 years ago

Oh, I see there's a convenience method that omits the validation flag. Except it just asserts that the URL wasn't malformed.

URL parsing falls under the category of input validation, and that means it's got to throw an Exception, not an Error. Even if an error were appropriate, it's not appropriate for it to be an AssertError with no message.