imessage_database/error/
attachment.rs1use std::{
6 fmt::{Display, Formatter, Result},
7 io::Error,
8};
9
10#[derive(Debug)]
12pub enum AttachmentError {
13 Unreadable(String, Error),
15}
16
17impl std::error::Error for AttachmentError {
18 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
19 match self {
20 AttachmentError::Unreadable(_, e) => Some(e),
21 }
22 }
23}
24
25impl Display for AttachmentError {
26 fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
27 match self {
28 AttachmentError::Unreadable(path, why) => {
29 write!(fmt, "Unable to read file at {path}: {why}")
30 }
31 }
32 }
33}