forked from nonsensical-dev/zenyx-engine
improve error handling
This commit is contained in:
parent
ff7ff5fb79
commit
2dd2398809
5 changed files with 112 additions and 54 deletions
|
@ -33,18 +33,29 @@ async fn main() -> anyhow::Result<()> {
|
|||
setup();
|
||||
|
||||
let repl_thread = std::thread::spawn(|| {
|
||||
let rt = runtime::Builder::new_current_thread()
|
||||
let rt = match runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
.build() {
|
||||
Ok(rt) => rt,
|
||||
Err(e) => {
|
||||
error!("A fatal error has occured: {e}");
|
||||
std::process::exit(1)
|
||||
},
|
||||
};
|
||||
rt.block_on(core::repl::input::handle_repl())
|
||||
});
|
||||
|
||||
let event_loop = EventLoop::new().unwrap();
|
||||
splash::print_splash();
|
||||
info!("Type 'help' for a list of commands.");
|
||||
|
||||
core::render::init_renderer(event_loop);
|
||||
match EventLoop::new() {
|
||||
Ok(event_loop) => {
|
||||
core::render::init_renderer(event_loop);
|
||||
}
|
||||
Err(e) => {
|
||||
error!("{e}")
|
||||
}
|
||||
};
|
||||
|
||||
if let Err(_) = repl_thread.join() {
|
||||
eprintln!("REPL thread panicked");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue