improve error message
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Johannes Heuel
2022-09-20 21:53:54 +02:00
parent 40ff666318
commit 9f2d06b1bb
2 changed files with 8 additions and 4 deletions

View File

@@ -129,8 +129,10 @@ async fn main() -> Result<(), Box<dyn Error>> {
)
.get_matches();
let server = matches.value_of("server").unwrap();
let secret = std::env::var("ZOIDBERG_SECRET")
.expect("Please set the $ZOIDBERG_SECRET environment variable");
let secret = std::env::var("ZOIDBERG_SECRET").unwrap_or_else(|_| {
println!("Please set the $ZOIDBERG_SECRET environment variable");
std::process::exit(1);
});
let client = Worker::new(server, &secret)
.await

View File

@@ -162,8 +162,10 @@ async fn submit(
async fn main() -> std::io::Result<()> {
env_logger::Builder::from_env(Env::default().default_filter_or("zoidberg_server=info")).init();
let secret = std::env::var("ZOIDBERG_SECRET")
.expect("Please set the $ZOIDBERG_SECRET environment variable");
let secret = std::env::var("ZOIDBERG_SECRET").unwrap_or_else(|_| {
println!("Please set the $ZOIDBERG_SECRET environment variable");
std::process::exit(1);
});
let _matches = clap::App::new("Zoidberg server")
.version(VERSION)