fix(simulator): add better error message when virtual device creation fails

This commit is contained in:
Yaseen
2026-01-22 01:32:56 +05:00
parent d681049ca8
commit cc3de63a92

View File

@@ -2,7 +2,6 @@ use std::env;
use std::error::Error; use std::error::Error;
use std::str::FromStr; use std::str::FromStr;
use log::error;
use rog_anime::usb::{PROD_ID, VENDOR_ID}; use rog_anime::usb::{PROD_ID, VENDOR_ID};
use rog_anime::{AnimeType, USB_PREFIX2}; use rog_anime::{AnimeType, USB_PREFIX2};
use sdl2::event::Event; use sdl2::event::Event;
@@ -87,8 +86,12 @@ impl VirtAnimeMatrix {
] ]
.to_vec(), .to_vec(),
}) })
.map_err(|err| error!("Could not create virtual device: {:?}", err)) .unwrap_or_else(|err| {
.expect("Could not create virtual device"), panic!(
"Could not create virtual device: {err:?}. \
Try loading the uhid module and ensure you have the necessary permissions."
)
}),
} }
} }