iron::itry
[−]
[src]
macro_rules! itry { ($result:expr) => { ... }; ($result:expr, $modifier:expr) => { ... }; }
Like try!()
, but wraps the error value in IronError
. To be used in
request handlers.
The second (optional) parameter is any modifier.
The default modifier is status::InternalServerError
.
let f = itry!(fs::File::create("foo.txt"), status::BadRequest); let f = itry!(fs::File::create("foo.txt"), (status::NotFound, "Not Found")); let f = itry!(fs::File::create("foo.txt")); // HTTP 500