use std::io;
use thiserror::Error;
pub type Result<T> = std::result::Result<T, PageMapError>;
#[derive(Debug, Error)]
pub enum PageMapError {
#[error("page is not present")]
PageNotPresent,
#[error("page is not swapped")]
PageNotSwapped,
#[error("could not open '{path}': {source}")]
Open {
path: String,
source: io::Error,
},
#[error("could not read '{path}': {source}")]
Read {
path: String,
source: io::Error,
},
#[error("could not seek in '{path}': {source}")]
Seek {
path: String,
source: io::Error,
},
#[error("could not access file '{0}'")]
Access(String),
#[error("I/O error: {0}")]
Io(#[from] io::Error),
#[error("could not parse MemoryRegion from the given addresses: {0}")]
ParseMemoryRegion(std::num::ParseIntError),
#[error("could not parse valid PagePermissions from '{0}'")]
ParsePagePermissions(String),
#[error("could not parse valid DeviceNumbers from '{0}'")]
ParseDeviceNumbers(String),
#[error(transparent)]
ParseIntError(#[from] std::num::ParseIntError),
}