1use core::fmt::Display;
5
6pub type Result<T, E = Error> = ::core::result::Result<T, E>;
7
8#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]
9pub enum Error {
10 #[error("Diff Error: {0}")]
11 DiffError(String),
12 #[error("Merge Error: {0}")]
13 MergeError(String),
14 #[error("Conversion Error: {0}")]
15 ConversionError(String),
16}
17
18impl Error {
19 pub fn diff<T>(message: T) -> Self
20 where
21 T: Display,
22 {
23 Self::DiffError(format!("{}", message))
24 }
25
26 pub fn merge<T>(message: T) -> Self
27 where
28 T: Display,
29 {
30 Self::MergeError(format!("{}", message))
31 }
32
33 pub fn convert<T>(message: T) -> Self
34 where
35 T: Display,
36 {
37 Self::ConversionError(format!("{}", message))
38 }
39}