imessage_database/error/attachment.rs
1/*!
2 Errors that can happen when parsing attachment data.
3*/
4
5use std::{
6 fmt::{Display, Formatter, Result},
7 io::Error,
8};
9
10/// Errors that can happen when working with attachment table data
11#[derive(Debug)]
12pub enum AttachmentError {
13 /// The attachment file exists but could not be read due to an IO error
14 Unreadable(String, Error),
15}
16
17impl Display for AttachmentError {
18 fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
19 match self {
20 AttachmentError::Unreadable(path, why) => {
21 write!(fmt, "Unable to read file at {path}: {why}")
22 }
23 }
24 }
25}