1use std::fmt::{Display, Formatter};
2
3
4pub enum BibleLibError {
6 InvalidCustomTranslationFile,
8 VerseNotFound,
10 ChapterNotFound,
12 BookNotFound,
14 InvalidVerseFormat,
16 IOError(std::io::Error),
18}
19
20impl Display for BibleLibError {
21 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
22 match self {
23 BibleLibError::InvalidCustomTranslationFile => {
24 write!(f, "The specified custom translation file is invalid or does not exist.")
25 }
26 BibleLibError::VerseNotFound => {
27 write!(f, "The specified verse was not found in the translation.")
28 }
29 BibleLibError::ChapterNotFound => {
30 write!(f, "The specified chapter was not found in the translation.")
31 }
32 BibleLibError::BookNotFound => {
33 write!(f, "The specified book was not found in the translation.")
34 }
35 BibleLibError::InvalidVerseFormat => {
36 write!(f, "The verse format provided is invalid.")
37 }
38 BibleLibError::IOError(e) => {
39 write!(f, "An I/O error occurred: {}", e)
40 }
41 }
42 }
43}