Skip to content

Commit

Permalink
Changed ConnectionError to InvalidURL
Browse files Browse the repository at this point in the history
  • Loading branch information
ContinuousFunction committed Nov 18, 2014
1 parent 087a27a commit 3246b1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion requests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def prepare_url(self, url, params):
try:
scheme, auth, host, port, path, query, fragment = parse_url(url)
except LocationParseError as e:
raise ConnectionError(e.message)
raise InvalidURL(e.message)

if not scheme:
raise MissingSchema("Invalid URL {0!r}: No schema supplied. "
Expand Down
4 changes: 2 additions & 2 deletions test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ def test_connection_error(self):
requests.get("http://httpbin.org:1")

def test_LocationParseError(self):
"""Inputing a URL that cannot be parsed should raise a ConnectionError"""
with pytest.raises(ConnectionError):
"""Inputing a URL that cannot be parsed should raise an InvalidURL error"""
with pytest.raises(InvalidURL):
requests.get("http://fe80::5054:ff:fe5a:fc0")

def test_basicauth_with_netrc(self):
Expand Down

0 comments on commit 3246b1f

Please sign in to comment.