Exceptions
There are two Exceptions that can be thrown by the Url class:
InvalidUrlExceptionwhen you try to create an instance from a string that isn't a valid Uri.InvalidUrlComponentExceptionwhen you try to set an invalid new value for a component (scheme, host,...).
When you're dealing with unpredictable input source, you should catch and handle them somehow.