Skip to content
Snippets Groups Projects
Verified Commit 1b9356cc authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

chore: improved error handling

parent 081117b3
No related branches found
No related tags found
1 merge request!16Support for Game Boy Color (CGB) 😎🖍️
Pipeline #2576 failed
......@@ -280,7 +280,12 @@ impl Cpu {
}
#[cfg(feature = "cpulog")]
println!("[0x{:04x}] {}\t({} cycles)", self.pc - 1, inst_str, inst_time);
println!(
"[0x{:04x}] {}\t({} cycles)",
self.pc - 1,
inst_str,
inst_time
);
#[cfg(feature = "secure")]
if self.mmu.boot_active() && self.pc - 1 > 0x08ff {
......
......@@ -3,7 +3,10 @@ use std::{cell::RefCell, fs::File, io::Read, rc::Rc};
pub type SharedMut<T> = Rc<RefCell<T>>;
pub fn read_file(path: &str) -> Vec<u8> {
let mut file = File::open(path).unwrap();
let mut file = match File::open(path) {
Ok(file) => file,
Err(_) => panic!("Failed to open file: {}", path),
};
let mut data = Vec::new();
file.read_to_end(&mut data).unwrap();
data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment