Files
nesemu/src/runtime/error.rs
se.cherkasov bdf23de8db
Some checks failed
CI / rust (push) Has been cancelled
Initial commit: NES emulator with GTK4 desktop frontend
Full NES emulation: CPU, PPU, APU, 47 mappers, iNES/NES 2.0 parsing.
GTK4 desktop client with HeaderBar, pixel-perfect Cairo rendering,
drag-and-drop ROM loading, and keyboard shortcuts.
187 tests covering core emulation, mappers, and runtime.
2026-03-13 11:48:45 +03:00

29 lines
856 B
Rust

use crate::CpuError;
use core::fmt;
#[derive(Debug)]
#[non_exhaustive]
pub enum RuntimeError {
RomParse(String),
MapperInit(String),
Cpu(CpuError),
BufferTooSmall { expected: usize, got: usize },
InvalidState(String),
}
impl fmt::Display for RuntimeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::RomParse(e) => write!(f, "ROM parse error: {e}"),
Self::MapperInit(e) => write!(f, "mapper init error: {e}"),
Self::Cpu(e) => write!(f, "CPU error: {e:?}"),
Self::BufferTooSmall { expected, got } => {
write!(f, "buffer too small: expected {expected} bytes, got {got}")
}
Self::InvalidState(e) => write!(f, "invalid runtime state: {e}"),
}
}
}
impl std::error::Error for RuntimeError {}