diff --git a/src/error.rs b/src/error.rs index 9eba058..e042609 100644 --- a/src/error.rs +++ b/src/error.rs @@ -185,6 +185,25 @@ pub fn too_many_redirects(url: Url) -> Error { } } +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())))); + } + } + ) +} + #[test] fn test_error_get_ref_downcasts() { let err: Error = from(::hyper::Error::Status);