Missed a couple .unwraps, take them out
This commit is contained in:
+10
-1
@@ -1,6 +1,7 @@
|
||||
use std::{error, fmt, io::Error as IoError};
|
||||
|
||||
use reqwest::{Error as HttpError, StatusCode};
|
||||
use hyper_old_types::Error as HeaderParseError;
|
||||
use reqwest::{header::ToStrError as HeaderStrError, Error as HttpError, StatusCode};
|
||||
use serde_json::Error as SerdeError;
|
||||
use serde_urlencoded::ser::Error as UrlEncodedError;
|
||||
#[cfg(feature = "toml")]
|
||||
@@ -49,6 +50,10 @@ pub enum Error {
|
||||
#[cfg(feature = "toml")]
|
||||
/// Error deserializing from toml
|
||||
TomlDe(TomlDeError),
|
||||
/// Error converting an http header to a string
|
||||
HeaderStrError(HeaderStrError),
|
||||
/// Error parsing the http Link header
|
||||
HeaderParseError(HeaderParseError),
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
@@ -83,6 +88,8 @@ impl error::Error for Error {
|
||||
Error::TomlSer(ref e) => e.description(),
|
||||
#[cfg(feature = "toml")]
|
||||
Error::TomlDe(ref e) => e.description(),
|
||||
Error::HeaderStrError(ref e) => e.description(),
|
||||
Error::HeaderParseError(ref e) => e.description(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,6 +126,8 @@ from! {
|
||||
ApiError, Api,
|
||||
#[cfg(feature = "toml")] TomlSerError, TomlSer,
|
||||
#[cfg(feature = "toml")] TomlDeError, TomlDe,
|
||||
HeaderStrError, HeaderStrError,
|
||||
HeaderParseError, HeaderParseError,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
+2
-2
@@ -107,9 +107,9 @@ fn get_links(response: &Response) -> Result<(Option<Url>, Option<Url>)> {
|
||||
let mut next = None;
|
||||
|
||||
if let Some(link_header) = response.headers().get(LINK) {
|
||||
let link_header = link_header.to_str().unwrap();
|
||||
let link_header = link_header.to_str()?;
|
||||
let link_header = link_header.as_bytes();
|
||||
let link_header: Link = parsing::from_raw_str(&link_header).unwrap();
|
||||
let link_header: Link = parsing::from_raw_str(&link_header)?;
|
||||
for value in link_header.values() {
|
||||
if let Some(relations) = value.rel() {
|
||||
if relations.contains(&RelationType::Next) {
|
||||
|
||||
Reference in New Issue
Block a user