Improve error handling

This commit is contained in:
Hanno Braun 2024-10-30 02:34:45 +01:00
parent 72fcf21580
commit 9cb33e8bd3

View File

@ -27,9 +27,15 @@ struct App {
impl ApplicationHandler for App {
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
let window = {
let window = event_loop
.create_window(WindowAttributes::default())
.unwrap();
let window =
match event_loop.create_window(WindowAttributes::default()) {
Ok(window) => window,
Err(err) => {
eprintln!("Failed to create window: `{err:?}`");
event_loop.exit();
return;
}
};
Arc::new(window)
};