Move try_ macro to error.rs.

Fixes #109.
This commit is contained in:
theduke
2017-05-31 23:04:39 +02:00
committed by Sean McArthur
parent e45f234b4a
commit 583fceb51f
2 changed files with 20 additions and 21 deletions

View File

@@ -182,6 +182,25 @@ where
InternalFrom(err, None).into()
}
macro_rules! try_ {
($e:expr) => (
match $e {
Ok(v) => v,
Err(err) => {
return Err(::Error::from(::error::InternalFrom(err, None)));
}
}
);
($e:expr, $url:expr) => (
match $e {
Ok(v) => v,
Err(err) => {
return Err(::Error::from(::error::InternalFrom(err, Some($url.clone()))));
}
}
)
}
#[inline]
pub fn loop_detected(url: Url) -> Error {
Error {