I'm wondering if anyone who is familiar with axum web server knows about how to gracefully capture a failure to bind to a socket. I have the following code:
match axum::Server::bind(&addr)
.serve(app.into_make_service())
.await {
Ok(()) => (),
Err(e) => {
println!("failed to bind e={:?}", e));
std::process::exit(1);
}
}
My wish is for the error to be caught and then a graceful exit happens without a panic, however what I get is the bind() appears to be panicing before my Err(e) arm is reached.
Any ideas on how to make this work would be greatly appreciated!