change Builders to only error at the end

Closes #189
This commit is contained in:
Sean McArthur
2017-08-31 11:45:24 -07:00
parent a02b388b2b
commit 779f8080ef
16 changed files with 390 additions and 313 deletions

View File

@@ -18,11 +18,11 @@ error_chain! {
}
}
fn main() {
let mut core = tokio_core::reactor::Core::new().unwrap();
let client = Client::new(&core.handle()).unwrap();
fn run() -> Result<()> {
let mut core = tokio_core::reactor::Core::new()?;
let client = Client::new(&core.handle());
let work = client.get("https://hyper.rs").unwrap()
let work = client.get("https://hyper.rs")
.send()
.map_err(|e| Error::from(e))
.and_then(|mut res| {
@@ -36,5 +36,8 @@ fn main() {
io::copy(&mut body, &mut io::stdout()).map_err(Into::into)
});
core.run(work).unwrap();
core.run(work)?;
Ok(())
}
quick_main!(run);