diff --git a/src/server.rs b/src/server.rs index ae588a6..565e692 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1,5 +1,6 @@ use std::borrow::Cow; use std::io::Cursor; +use std::process::exit; use tiny_http::Header; use tiny_http::Request; @@ -12,7 +13,13 @@ use tiny_http::StatusCode; /// Runs the server in a single thread, bound to 0.0.0.0 on the provided port. Requests are /// handled first-come, first-serve pub fn go(domains: &[&str], port: u16) { - let server = Server::http(("0.0.0.0", port)).unwrap(); + let server = match Server::http(("0.0.0.0", port)) { + Ok(s) => s, + Err(e) => { + eprintln!("Couldn't create server on 0.0.0.0:{port}\n{e}"); + exit(1004); + } + }; println!("Running on 0.0.0.0:{port}");