Skip to content

Commit

Permalink
Rename ErrorKind::HttpClient => ErrorKind::Http
Browse files Browse the repository at this point in the history
  • Loading branch information
spk committed Mar 7, 2020
1 parent e150c1f commit df30fe6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/http/reqwest/sync_reqwest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ impl RobotsTxtClient for Client {
let url = Url::parse(&url).map_err(|err| RobotparserError {kind: ErrorKind::Url(err)})?;
let mut request = Request::new(Method::GET, url);
let _ = request.headers_mut().insert(USER_AGENT, HeaderValue::from_static(DEFAULT_USER_AGENT));
let response = self.execute(request).map_err(|err| RobotparserError {kind: ErrorKind::HttpClient(err)})?;
let response = self.execute(request).map_err(|err| RobotparserError {kind: ErrorKind::Http(err)})?;
let status_code = response.status().as_u16();
let text = response.text().map_err(|err| RobotparserError {kind: ErrorKind::HttpClient(err)})?;
let text = response.text().map_err(|err| RobotparserError {kind: ErrorKind::Http(err)})?;
let robots_txt = parse_fetched_robots_txt(origin, status_code, &text);
return Ok(robots_txt);
}
Expand Down
4 changes: 2 additions & 2 deletions src/model/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ pub struct RobotparserError {
#[derive(Debug)]
pub enum ErrorKind {
Url(url::ParseError),
HttpClient(reqwest::Error),
Http(reqwest::Error),
}

impl fmt::Display for RobotparserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.kind {
ErrorKind::Url(ref err) => err.fmt(f),
ErrorKind::HttpClient(ref err) => err.fmt(f),
ErrorKind::Http(ref err) => err.fmt(f),
}
}
}

0 comments on commit df30fe6

Please sign in to comment.