Slightly better error message when malformed urls make it into make_connection

This commit is contained in:
Ryan Williams
2009-06-07 10:09:39 -07:00
parent 63f5f8c4d0
commit 629204d669

View File

@@ -510,8 +510,10 @@ def make_connection(scheme, location, use_proxy):
def connect(url, use_proxy=False):
""" Create a connection object to the host specified in a url. Convenience function for make_connection."""
scheme, location = url_parser(url)[:2]
return make_connection(scheme, location, use_proxy)
try:
return make_connection(scheme, location, use_proxy)
except KeyError:
raise ValueError("Unknown url scheme %s in url %s" % (scheme, url))
def make_safe_loader(loader):
if not callable(loader):