summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/client.rs7
-rw-r--r--src/client/main.rs2
2 files changed, 4 insertions, 5 deletions
diff --git a/src/client/client.rs b/src/client/client.rs
index 617b688..37128b3 100644
--- a/src/client/client.rs
+++ b/src/client/client.rs
@@ -51,7 +51,7 @@ impl<C: Connection> std::fmt::Display for Client<C> {
}
impl<C: Connection> Client<C> {
- pub fn new(connector: C) -> Self {
+ pub fn new(connector: C) -> Result<Self, C::Err> {
let c = Self {
ip: connector.get_ip(),
connector,
@@ -69,9 +69,8 @@ impl<C: Connection> Client<C> {
},
env: std::env::vars().collect(),
};
- // FIXME: handle this and all unwraps
- c.connector.init(&c).unwrap();
- c
+ c.connector.init(&c)?;
+ Ok(c)
}
pub fn enter_loop(mut self) -> ! {
diff --git a/src/client/main.rs b/src/client/main.rs
index 24c8a8b..fa2017d 100644
--- a/src/client/main.rs
+++ b/src/client/main.rs
@@ -38,6 +38,6 @@ fn main() {
]); // discard err
let ip = "http://127.0.0.1:8080";
- let client = Client::new(HTTPConnector::new(ip, ip, "/").unwrap());
+ let client = Client::new(HTTPConnector::new(ip, ip, "/").unwrap()).unwrap();
client.enter_loop();
}