use std::fmt::{Display, Formatter};
#[derive(Debug)]
pub enum BibleLibError {
InvalidCustomTranslationFile,
VerseNotFound,
ChapterNotFound,
BookNotFound,
InvalidVerseFormat,
IOError(std::io::Error),
}
impl Display for BibleLibError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
BibleLibError::InvalidCustomTranslationFile => {
write!(f, "The specified custom translation file is invalid or does not exist.")
}
BibleLibError::VerseNotFound => {
write!(f, "The specified verse was not found in the translation.")
}
BibleLibError::ChapterNotFound => {
write!(f, "The specified chapter was not found in the translation.")
}
BibleLibError::BookNotFound => {
write!(f, "The specified book was not found in the translation.")
}
BibleLibError::InvalidVerseFormat => {
write!(f, "The verse format provided is invalid.")
}
BibleLibError::IOError(e) => {
write!(f, "An I/O error occurred: {}", e)
}
}
}
}