summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-09-03 13:53:55 +0200
committerMatthias Beyer <mail@beyermatthias.de>2017-09-03 15:42:06 +0200
commit603808a9faba93bc1dea8a5004ffc402e2630a5d (patch)
tree1b0f0ea3718854fa54ad1c309383c32747cf7e79
parent9713a4632ca2c52af4fab392bd6c479b4ac7db1a (diff)
Impl IntoError for error kinds
-rw-r--r--bin/core/imag-store/src/error.rs11
-rw-r--r--lib/core/libimagrt/src/configuration.rs12
-rw-r--r--lib/core/libimagstore/src/error.rs11
-rw-r--r--lib/domain/libimagbookmark/src/error.rs11
-rw-r--r--lib/domain/libimagcounter/src/error.rs11
-rw-r--r--lib/domain/libimagdiary/src/error.rs11
-rw-r--r--lib/domain/libimagmail/src/error.rs11
-rw-r--r--lib/domain/libimagnotes/src/error.rs11
-rw-r--r--lib/domain/libimagtimetrack/src/error.rs11
-rw-r--r--lib/domain/libimagtodo/src/error.rs11
-rw-r--r--lib/entry/libimagentryannotation/src/error.rs11
-rw-r--r--lib/entry/libimagentrycategory/src/error.rs11
-rw-r--r--lib/entry/libimagentrydatetime/src/datepath/error.rs12
-rw-r--r--lib/entry/libimagentrydatetime/src/error.rs11
-rw-r--r--lib/entry/libimagentrydatetime/src/range.rs12
-rw-r--r--lib/entry/libimagentryedit/src/error.rs12
-rw-r--r--lib/entry/libimagentrylink/src/error.rs11
-rw-r--r--lib/entry/libimagentrylist/src/error.rs11
-rw-r--r--lib/entry/libimagentrymarkdown/src/error.rs11
-rw-r--r--lib/entry/libimagentryref/src/error.rs11
-rw-r--r--lib/entry/libimagentrytag/src/error.rs11
-rw-r--r--lib/entry/libimagentryview/src/error.rs12
-rw-r--r--lib/etc/libimaginteraction/src/error.rs11
23 files changed, 258 insertions, 0 deletions
diff --git a/bin/core/imag-store/src/error.rs b/bin/core/imag-store/src/error.rs
index d74e4a30..163ae344 100644
--- a/bin/core/imag-store/src/error.rs
+++ b/bin/core/imag-store/src/error.rs
@@ -39,3 +39,14 @@ error_chain! {
pub use self::error::StoreError;
pub use self::error::StoreErrorKind;
+impl IntoError for StoreErrorKind {
+ type Target = StoreError;
+
+ fn into_error(self) -> Self::Target {
+ StoreError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ StoreError::from_kind(self)
+ }
+}
diff --git a/lib/core/libimagrt/src/configuration.rs b/lib/core/libimagrt/src/configuration.rs
index 4e064c02..ef2fe267 100644
--- a/lib/core/libimagrt/src/configuration.rs
+++ b/lib/core/libimagrt/src/configuration.rs
@@ -60,6 +60,18 @@ error_chain! {
pub use self::error::{ConfigError, ConfigErrorKind, MapErrInto};
use libimagerror::into::IntoError;
+impl IntoError for ConfigErrorKind {
+ type Target = ConfigError;
+
+ fn into_error(self) -> Self::Target {
+ ConfigError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ ConfigError::from_kind(self)
+ }
+}
+
/// `Configuration` object
///
/// Holds all config variables which are globally available plus the configuration object from the
diff --git a/lib/core/libimagstore/src/error.rs b/lib/core/libimagstore/src/error.rs
index 8bba587f..61bf7835 100644
--- a/lib/core/libimagstore/src/error.rs
+++ b/lib/core/libimagstore/src/error.rs
@@ -293,3 +293,14 @@ error_chain! {
}
}
+impl IntoError for StoreErrorKind {
+ type Target: StoreError;
+
+ fn into_error(self) -> Self::Target {
+ StoreError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ StoreError::from_kind(self)
+ }
+}
diff --git a/lib/domain/libimagbookmark/src/error.rs b/lib/domain/libimagbookmark/src/error.rs
index ef01a790..671c0ead 100644
--- a/lib/domain/libimagbookmark/src/error.rs
+++ b/lib/domain/libimagbookmark/src/error.rs
@@ -55,3 +55,14 @@ pub use self::error::BookmarkError;
pub use self::error::BookmarkErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for BookmarkErrorKind {
+ type Target = BookmarkError;
+
+ fn into_error(self) -> Self::Target {
+ BookmarkError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ BookmarkError::from_kind(self)
+ }
+}
diff --git a/lib/domain/libimagcounter/src/error.rs b/lib/domain/libimagcounter/src/error.rs
index 726eed60..7bf42d16 100644
--- a/lib/domain/libimagcounter/src/error.rs
+++ b/lib/domain/libimagcounter/src/error.rs
@@ -54,3 +54,14 @@ error_chain! {
pub use self::error::CounterError;
pub use self::error::CounterErrorKind;
+impl IntoError for CounterErrorKind {
+ type Target = CounterError;
+
+ fn into_error(self) -> Self::Target {
+ CounterError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ CounterError::from_kind(self)
+ }
+}
diff --git a/lib/domain/libimagdiary/src/error.rs b/lib/domain/libimagdiary/src/error.rs
index 53b484a7..5eb12274 100644
--- a/lib/domain/libimagdiary/src/error.rs
+++ b/lib/domain/libimagdiary/src/error.rs
@@ -80,3 +80,14 @@ pub use self::error::DiaryError;
pub use self::error::DiaryErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for DiaryErrorKind {
+ type Target = DiaryError;
+
+ fn into_error(self) -> Self::Target {
+ DiaryError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ DiaryError::from_kind(self)
+ }
+}
diff --git a/lib/domain/libimagmail/src/error.rs b/lib/domain/libimagmail/src/error.rs
index 19a67fd6..65eb2b31 100644
--- a/lib/domain/libimagmail/src/error.rs
+++ b/lib/domain/libimagmail/src/error.rs
@@ -47,3 +47,14 @@ pub use self::error::MailError;
pub use self::error::MailErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for MailErrorKind {
+ type Target = MailError;
+
+ fn into_error(self) -> Self::Target {
+ MailError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ MailError::from_kind(self)
+ }
+}
diff --git a/lib/domain/libimagnotes/src/error.rs b/lib/domain/libimagnotes/src/error.rs
index e2793b1c..8b7e6186 100644
--- a/lib/domain/libimagnotes/src/error.rs
+++ b/lib/domain/libimagnotes/src/error.rs
@@ -50,3 +50,14 @@ pub use self::error::NoteError;
pub use self::error::NoteErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for NoteErrorKind {
+ type Target = NoteError;
+
+ fn into_error(self) -> Self::Target {
+ NoteError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ NoteError::from_kind(self)
+ }
+}
diff --git a/lib/domain/libimagtimetrack/src/error.rs b/lib/domain/libimagtimetrack/src/error.rs
index 429d302a..008074a7 100644
--- a/lib/domain/libimagtimetrack/src/error.rs
+++ b/lib/domain/libimagtimetrack/src/error.rs
@@ -56,3 +56,14 @@ pub use self::error::TimeTrackError;
pub use self::error::TimeTrackErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for TimeTrackErrorKind {
+ type Target = TimeTrackError;
+
+ fn into_error(self) -> Self::Target {
+ TimeTrackError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ TimeTrackError::from_kind(self)
+ }
+}
diff --git a/lib/domain/libimagtodo/src/error.rs b/lib/domain/libimagtodo/src/error.rs
index 84a822b2..bfb508d2 100644
--- a/lib/domain/libimagtodo/src/error.rs
+++ b/lib/domain/libimagtodo/src/error.rs
@@ -55,3 +55,14 @@ pub use self::error::TodoError;
pub use self::error::TodoErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for TodoErrorKind {
+ type Target = TodoError;
+
+ fn into_error(self) -> Self::Target {
+ TodoError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ TodoError::from_kind(self)
+ }
+ }
diff --git a/lib/entry/libimagentryannotation/src/error.rs b/lib/entry/libimagentryannotation/src/error.rs
index e53c925f..6355048e 100644
--- a/lib/entry/libimagentryannotation/src/error.rs
+++ b/lib/entry/libimagentryannotation/src/error.rs
@@ -60,3 +60,14 @@ pub use self::error::AnnotationError;
pub use self::error::AnnotationErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for AnnotationErrorKind {
+ type Target = AnnotationError;
+
+ fn into_error(self) -> Self::Target {
+ AnnotationError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ AnnotationError::from_kind(self)
+ }
+}
diff --git a/lib/entry/libimagentrycategory/src/error.rs b/lib/entry/libimagentrycategory/src/error.rs
index 3de6d768..ceb114cb 100644
--- a/lib/entry/libimagentrycategory/src/error.rs
+++ b/lib/entry/libimagentrycategory/src/error.rs
@@ -54,3 +54,14 @@ pub use self::error::CategoryError;
pub use self::error::CategoryErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for CategoryErrorKind {
+ type Target = CategoryError;
+
+ fn into_error(self) -> Self::Target {
+ CategoryError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ CategoryError::from_kind(self)
+ }
+}
diff --git a/lib/entry/libimagentrydatetime/src/datepath/error.rs b/lib/entry/libimagentrydatetime/src/datepath/error.rs
index d0b28665..f080e5ac 100644
--- a/lib/entry/libimagentrydatetime/src/datepath/error.rs
+++ b/lib/entry/libimagentrydatetime/src/datepath/error.rs
@@ -37,3 +37,15 @@ error_chain! {
}
pub use self::error::DatePathCompilerError;
+
+impl IntoError for DatePathCompilerErrorKind {
+ type Target = DatePathCompilerError;
+
+ fn into_error(self) -> Self::Target {
+ DatePathCompilerError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ DatePathCompilerError::from_kind(self)
+ }
+}
diff --git a/lib/entry/libimagentrydatetime/src/error.rs b/lib/entry/libimagentrydatetime/src/error.rs
index cf434aca..c49bb8c4 100644
--- a/lib/entry/libimagentrydatetime/src/error.rs
+++ b/lib/entry/libimagentrydatetime/src/error.rs
@@ -75,3 +75,14 @@ pub use self::error::DateError;
pub use self::error::DateErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for DateErrorKind {
+ type Target = DateError;
+
+ fn into_error(self) -> Self::Target {
+ DateError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ DateError::from_kind(self)
+ }
+}
diff --git a/lib/entry/libimagentrydatetime/src/range.rs b/lib/entry/libimagentrydatetime/src/range.rs
index 52c8095a..f729dfde 100644
--- a/lib/entry/libimagentrydatetime/src/range.rs
+++ b/lib/entry/libimagentrydatetime/src/range.rs
@@ -35,6 +35,18 @@ pub use self::error::DateTimeRangeError;
pub use self::error::DateTimeRangeErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for DateTimeRangeErrorKind {
+ type Target = DateTimeRangeError;
+
+ fn into_error(self) -> Self::Target {
+ DateTimeRangeError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ DateTimeRangeError::from_kind(self)
+ }
+}
+
use chrono::naive::NaiveDateTime;
use libimagerror::into::IntoError;
use self::result::Result;
diff --git a/lib/entry/libimagentryedit/src/error.rs b/lib/entry/libimagentryedit/src/error.rs
index fde19983..a37c7e80 100644
--- a/lib/entry/libimagentryedit/src/error.rs
+++ b/lib/entry/libimagentryedit/src/error.rs
@@ -50,3 +50,15 @@ pub use self::error::EditError;
pub use self::error::EditErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for EditErrorKind {
+ type Target = EditError;
+
+ fn into_error(self) -> Self::Target {
+ EditError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ EditError::from_kind(self)
+ }
+}
+
diff --git a/lib/entry/libimagentrylink/src/error.rs b/lib/entry/libimagentrylink/src/error.rs
index 5b315149..d9bf3db2 100644
--- a/lib/entry/libimagentrylink/src/error.rs
+++ b/lib/entry/libimagentrylink/src/error.rs
@@ -90,3 +90,14 @@ pub use self::error::LinkError;
pub use self::error::LinkErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for LinkErrorKind {
+ type Target = LinkError;
+
+ fn into_error(self) -> Self::Target {
+ LinkError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ LinkError::from_kind(self)
+ }
+}
diff --git a/lib/entry/libimagentrylist/src/error.rs b/lib/entry/libimagentrylist/src/error.rs
index e743c468..fd5aea59 100644
--- a/lib/entry/libimagentrylist/src/error.rs
+++ b/lib/entry/libimagentrylist/src/error.rs
@@ -55,3 +55,14 @@ pub use self::error::ListError;
pub use self::error::ListErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for ListErrorKind {
+ type Target = ListError;
+
+ fn into_error(self) -> Self::Target {
+ ListError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ ListError::from_kind(self)
+ }
+}
diff --git a/lib/entry/libimagentrymarkdown/src/error.rs b/lib/entry/libimagentrymarkdown/src/error.rs
index da099a7d..b3956d0e 100644
--- a/lib/entry/libimagentrymarkdown/src/error.rs
+++ b/lib/entry/libimagentrymarkdown/src/error.rs
@@ -40,3 +40,14 @@ pub use self::error::MarkdownError;
pub use self::error::MarkdownErrorKind;
+impl IntoError for MarkdownErrorKind {
+ type Target = MarkdownError;
+
+ fn into_error(self) -> Self::Target {
+ MarkdownError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ MarkdownError::from_kind(self)
+ }
+}
diff --git a/lib/entry/libimagentryref/src/error.rs b/lib/entry/libimagentryref/src/error.rs
index fb413929..4f9f155c 100644
--- a/lib/entry/libimagentryref/src/error.rs
+++ b/lib/entry/libimagentryref/src/error.rs
@@ -145,3 +145,14 @@ pub use self::error::RefError;
pub use self::error::RefErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for RefErrorKind {
+ type Target = RefError;
+
+ fn into_error(self) -> Self::Target {
+ RefError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ RefError::from_kind(self)
+ }
+}
diff --git a/lib/entry/libimagentrytag/src/error.rs b/lib/entry/libimagentrytag/src/error.rs
index cde51b1c..0c2e8204 100644
--- a/lib/entry/libimagentrytag/src/error.rs
+++ b/lib/entry/libimagentrytag/src/error.rs
@@ -50,3 +50,14 @@ pub use self::error::TagError;
pub use self::error::TagErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for TagErrorKind {
+ type Target = TagError;
+
+ fn into_error(self) -> Self::Target {
+ TagError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ TagError::from_kind(self)
+ }
+}
diff --git a/lib/entry/libimagentryview/src/error.rs b/lib/entry/libimagentryview/src/error.rs
index 5e1c5f11..a7d29d52 100644
--- a/lib/entry/libimagentryview/src/error.rs
+++ b/lib/entry/libimagentryview/src/error.rs
@@ -54,3 +54,15 @@ error_chain! {
pub use self::error::ViewError;
pub use self::error::ViewErrorKind;
pub use self::error::MapErrInto;
+
+impl IntoError for ViewErrorKind {
+ type Target = ViewError;
+
+ fn into_error(self) -> Self::Target {
+ ViewError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ ViewError::from_kind(self)
+ }
+}
diff --git a/lib/etc/libimaginteraction/src/error.rs b/lib/etc/libimaginteraction/src/error.rs
index b54c54a4..271bf832 100644
--- a/lib/etc/libimaginteraction/src/error.rs
+++ b/lib/etc/libimaginteraction/src/error.rs
@@ -85,3 +85,14 @@ pub use self::error::InteractionError;
pub use self::error::InteractionErrorKind;
pub use self::error::MapErrInto;
+impl IntoError for InteractionErrorKind {
+ type Target = InteractionError;
+
+ fn into_error(self) -> Self::Target {
+ InteractionError::from_kind(self)
+ }
+
+ fn into_error_with_cause(self, cause: Box<Error>) -> Self::Target {
+ InteractionError::from_kind(self)
+ }
+}