File tree Expand file tree Collapse file tree 2 files changed +22
-21
lines changed
Expand file tree Collapse file tree 2 files changed +22
-21
lines changed Original file line number Diff line number Diff line change @@ -185,26 +185,6 @@ pub fn too_many_redirects(url: Url) -> Error {
185185 }
186186}
187187
188- #[ macro_export]
189- macro_rules! try_ {
190- ( $e: expr) => (
191- match $e {
192- Ok ( v) => v,
193- Err ( err) => {
194- return Err ( :: Error :: from( :: error:: InternalFrom ( err, None ) ) ) ;
195- }
196- }
197- ) ;
198- ( $e: expr, $url: expr) => (
199- match $e {
200- Ok ( v) => v,
201- Err ( err) => {
202- return Err ( :: Error :: from( :: error:: InternalFrom ( err, Some ( $url. clone( ) ) ) ) ) ;
203- }
204- }
205- )
206- }
207-
208188#[ test]
209189fn test_error_get_ref_downcasts ( ) {
210190 let err: Error = from ( :: hyper:: Error :: Status ) ;
Original file line number Diff line number Diff line change @@ -108,6 +108,27 @@ extern crate serde_json;
108108extern crate serde_urlencoded;
109109extern crate url;
110110
111+ // should be in error.rs module, but due to scopes of macros,
112+ // other modules won't see it there.
113+ macro_rules! try_ {
114+ ( $e: expr) => (
115+ match $e {
116+ Ok ( v) => v,
117+ Err ( err) => {
118+ return Err ( :: Error :: from( :: error:: InternalFrom ( err, None ) ) ) ;
119+ }
120+ }
121+ ) ;
122+ ( $e: expr, $url: expr) => (
123+ match $e {
124+ Ok ( v) => v,
125+ Err ( err) => {
126+ return Err ( :: Error :: from( :: error:: InternalFrom ( err, Some ( $url. clone( ) ) ) ) ) ;
127+ }
128+ }
129+ )
130+ }
131+
111132pub use hyper:: client:: IntoUrl ;
112133pub use hyper:: Error as HyperError ;
113134pub use hyper:: header;
@@ -124,7 +145,7 @@ pub use self::body::Body;
124145pub use self :: redirect:: RedirectPolicy ;
125146pub use self :: response:: Response ;
126147
127- # [ macro_use ] mod error;
148+ mod error;
128149mod body;
129150mod client;
130151mod redirect;
You can’t perform that action at this time.
0 commit comments