summaryrefslogtreecommitdiffstats
path: root/examples/tinydb.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tinydb.rs')
-rw-r--r--examples/tinydb.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/tinydb.rs b/examples/tinydb.rs
index 134d01b1..702704d3 100644
--- a/examples/tinydb.rs
+++ b/examples/tinydb.rs
@@ -74,12 +74,12 @@ enum Response {
Error { msg: String },
}
-fn main() {
+fn main() -> Result<(), Box<std::error::Error>> {
// Parse the address we're going to run this server on
// and set up our TCP listener to accept connections.
let addr = env::args().nth(1).unwrap_or("127.0.0.1:8080".to_string());
- let addr = addr.parse::<SocketAddr>().unwrap();
- let listener = TcpListener::bind(&addr).expect("failed to bind");
+ let addr = addr.parse::<SocketAddr>()?;
+ let listener = TcpListener::bind(&addr).map_err(|_| "failed to bind")?;
println!("Listening on: {}", addr);
// Create the shared state of this server that will be shared amongst all
@@ -156,6 +156,7 @@ fn main() {
});
tokio::run(done);
+ Ok(())
}
impl Request {