diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2017-09-03 13:53:55 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2017-09-03 15:42:06 +0200 |
commit | 603808a9faba93bc1dea8a5004ffc402e2630a5d (patch) | |
tree | 1b0f0ea3718854fa54ad1c309383c32747cf7e79 /lib/entry/libimagentrydatetime | |
parent | 9713a4632ca2c52af4fab392bd6c479b4ac7db1a (diff) |
Impl IntoError for error kinds
Diffstat (limited to 'lib/entry/libimagentrydatetime')
-rw-r--r-- | lib/entry/libimagentrydatetime/src/datepath/error.rs | 12 | ||||
-rw-r--r-- | lib/entry/libimagentrydatetime/src/error.rs | 11 | ||||
-rw-r--r-- | lib/entry/libimagentrydatetime/src/range.rs | 12 |
3 files changed, 35 insertions, 0 deletions
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; |