De-redundantize Error kinds. (#259)

Change "Bad" to "Invalid" in error names, mimicking io::Error::ErrorKind.

Change InvalidProxyCreds to ProxyUnauthorized.

Change DnsFailed to just Dns (the fact that there was a failure is implicit
in the fact that this was an error).
This commit is contained in:
Jacob Hoffman-Andrews
2020-12-05 12:05:29 -08:00
committed by GitHub
parent 57f251d766
commit 6c9378ce37
7 changed files with 27 additions and 30 deletions

View File

@@ -172,7 +172,7 @@ pub(crate) fn connect(
let host = unit
.url
.host_str()
.ok_or(ErrorKind::BadUrl.msg("no host in URL"))?;
.ok_or(ErrorKind::InvalidUrl.msg("no host in URL"))?;
let url = &unit.url;
let method = &unit.method;
// open socket
@@ -241,7 +241,7 @@ pub(crate) fn connect(
if let Some(location) = location {
// join location header to current url in case it it relative
let new_url = url.join(location).map_err(|e| {
ErrorKind::BadUrl
ErrorKind::InvalidUrl
.msg(&format!("Bad redirection: {}", location))
.src(e)
})?;