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