Impl IntoError for error kinds

This commit is contained in:
Matthias Beyer 2017-09-03 13:53:55 +02:00
parent 9713a4632c
commit 603808a9fa
23 changed files with 258 additions and 0 deletions

View file

@ -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)
}
}

View file

@ -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

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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;

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}