aboutsummaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/error.rs b/src/error.rs
index 7172d04..97a4e62 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -6,21 +6,21 @@ pub type ArchiveResult<T, E> = Result<T, ArchiveError<E>>;
6 6
7#[derive(Debug)] 7#[derive(Debug)]
8pub enum ArchiveError<E: Error> { 8pub enum ArchiveError<E: Error> {
9 IO { error: io::Error }, 9 Io { error: io::Error },
10 Serde { message: String }, 10 Serde { message: String },
11 Archivator { module: String, error: E }, 11 Archivator { module: String, error: E },
12} 12}
13 13
14impl<E: Error> From<io::Error> for ArchiveError<E> { 14impl<E: Error> From<io::Error> for ArchiveError<E> {
15 fn from(value: io::Error) -> Self { 15 fn from(value: io::Error) -> Self {
16 Self::IO { error: value } 16 Self::Io { error: value }
17 } 17 }
18} 18}
19 19
20impl<E: Error> Display for ArchiveError<E> { 20impl<E: Error> Display for ArchiveError<E> {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 match self { 22 match self {
23 Self::IO { error } => writeln!(f, "IO: {error}"), 23 Self::Io { error } => writeln!(f, "IO: {error}"),
24 Self::Serde { message } => writeln!(f, "Serde: {message}"), 24 Self::Serde { message } => writeln!(f, "Serde: {message}"),
25 Self::Archivator { module, error } => writeln!(f, "{module}: {error}"), 25 Self::Archivator { module, error } => writeln!(f, "{module}: {error}"),
26 } 26 }