error message rather than panic
This commit is contained in:
parent
09b1cb1e57
commit
ad8d001f0c
16
src/main.rs
16
src/main.rs
|
@ -108,8 +108,20 @@ fn main() {
|
|||
*v = args.verbose;
|
||||
}
|
||||
|
||||
let rom: ROM = ROM::load(fs::read(args.rom).expect("Could not load ROM"));
|
||||
let bootrom: Vec<u8> = fs::read(args.bootrom).expect("Could not load BootROM");
|
||||
let rom: ROM = match fs::read(args.rom) {
|
||||
Ok(data) => ROM::load(data),
|
||||
Err(e) => {
|
||||
println!("Error reading ROM: {}", e.to_string());
|
||||
return;
|
||||
}
|
||||
};
|
||||
let bootrom: Vec<u8> = match fs::read(args.bootrom) {
|
||||
Ok(data) => data,
|
||||
Err(e) => {
|
||||
println!("Error reading bootROM: {}", e.to_string());
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let mut window = Window::new(
|
||||
format!("{}", rom.get_title()).as_str(),
|
||||
|
|
Loading…
Reference in a new issue