Clarify error when unable to parse listen address

This commit is contained in:
Tangent Wantwight 2020-05-11 08:59:23 -04:00
parent d031061c41
commit a22ca95d3d

View file

@ -1,4 +1,4 @@
use anyhow::Result; use anyhow::{Context, Result};
use futures::stream::{FuturesUnordered, StreamExt}; use futures::stream::{FuturesUnordered, StreamExt};
use std::net::ToSocketAddrs; use std::net::ToSocketAddrs;
use structopt::StructOpt; use structopt::StructOpt;
@ -25,7 +25,10 @@ async fn main() -> Result<()> {
}) })
}); });
let addrs = args.listen.to_socket_addrs()?; let addrs = args
.listen
.to_socket_addrs()
.context("Couldn't parse the listen address")?;
let servers = FuturesUnordered::new(); let servers = FuturesUnordered::new();
for addr in addrs { for addr in addrs {
let (_, server) = serve(socket_handler).try_bind_ephemeral(addr)?; let (_, server) = serve(socket_handler).try_bind_ephemeral(addr)?;