#[cfg(feature = "std")]
use thiserror::Error;
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "std", derive(Error))]
pub enum Chip8Error {
#[cfg_attr(feature = "std", error("invalid register {0:?}"))]
InvalidRegister(u8),
#[cfg_attr(feature = "std", error("unknown instruction {0:?}"))]
UnknownInstruction(u16),
#[cfg_attr(feature = "std", error("unimplemented instruction {0:?}"))]
UnimplementedInstruction(crate::instructions::Instruction),
#[cfg_attr(feature = "std", error("invalid key {0:?}"))]
InvalidKey(u8),
#[cfg_attr(feature = "std", error("out of range {0:?}"))]
OutOfRange(u16),
}
pub type Result<T> = core::result::Result<T, Chip8Error>;