wait for user input before crash after init_assets() error
This commit is contained in:
parent
e84cad1f79
commit
27ca664829
1 changed files with 13 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
use std::io::{stdin, Read};
|
||||
|
||||
use anyhow::Result;
|
||||
use tracing::Level;
|
||||
|
||||
|
@ -15,7 +17,10 @@ use logging::{init_logging, init_system_logging};
|
|||
async fn main() -> Result<()> {
|
||||
init_logging();
|
||||
init_config();
|
||||
init_assets()?;
|
||||
if let Err(err) = init_assets() {
|
||||
tracing::error!("Error occurred during assets initialization: {err}");
|
||||
on_critical_fault();
|
||||
}
|
||||
|
||||
let span = tracing::span!(Level::DEBUG, "main");
|
||||
let _enter = span.enter();
|
||||
|
@ -26,3 +31,10 @@ async fn main() -> Result<()> {
|
|||
|
||||
net::gateway::listen(&CONFIGURATION.gateway_endpoint).await
|
||||
}
|
||||
|
||||
fn on_critical_fault() {
|
||||
eprintln!("Critical error occurred, press any key to exit...");
|
||||
|
||||
let _ = stdin().read(&mut [0u8]).unwrap();
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue