improve error handling

This commit is contained in:
Chance 2025-04-01 18:05:17 -04:00 committed by BitSyndicate
parent ff7ff5fb79
commit 2dd2398809
Signed by untrusted user: bitsyndicate
GPG key ID: 443E4198D6BBA6DE
5 changed files with 112 additions and 54 deletions

View file

@ -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");
}