Do you wish to register an account?
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

24 lines
752 B

use std::fmt;
/// Representation of our possible errors.
/// Each variant will contain a string for more
/// detailed information
#[derive(Debug)]
pub enum Error {
/// An error related to the first 16 bytes
HeaderString(String),
/// An error parsing the page size
InvalidPageSize(String),
}
impl fmt::Display for Error {
/// This will be called whenever we print
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::HeaderString(v) => write!(f, "Unexpected bytes at start of file, expected the magic string 'SQLite format 3\u{0}', found {:?}", v),
Self::InvalidPageSize(msg) => write!(f, "Invalid page size, {}", msg),
}
}
}
impl std::error::Error for Error {}