summaryrefslogtreecommitdiffstats
path: root/lib/entry/libimagentryannotation
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-09-03 21:28:36 +0200
committerMatthias Beyer <mail@beyermatthias.de>2017-09-03 21:34:07 +0200
commit7ce44e80905cc60c656e385c7d1a4bb769f2c115 (patch)
tree9984e5d58814713c90db8624f87dbd759b2ff9be /lib/entry/libimagentryannotation
parent28d7085b2dbef61b95e41f05a276b256d66918dc (diff)
Remove "IntoError" trait, use error_chain functionality
Diffstat (limited to 'lib/entry/libimagentryannotation')
-rw-r--r--lib/entry/libimagentryannotation/src/annotateable.rs4
-rw-r--r--lib/entry/libimagentryannotation/src/annotation_fetcher.rs4
-rw-r--r--lib/entry/libimagentryannotation/src/error.rs15
3 files changed, 4 insertions, 19 deletions
diff --git a/lib/entry/libimagentryannotation/src/annotateable.rs b/lib/entry/libimagentryannotation/src/annotateable.rs
index 85f5f89a..b356753e 100644
--- a/lib/entry/libimagentryannotation/src/annotateable.rs
+++ b/lib/entry/libimagentryannotation/src/annotateable.rs
@@ -25,13 +25,13 @@ use libimagstore::store::Entry;
use libimagstore::store::FileLockEntry;
use libimagstore::store::Store;
use libimagentrylink::internal::InternalLinker;
-use libimagerror::into::IntoError;
use toml_query::read::TomlValueReadExt;
use toml_query::insert::TomlValueInsertExt;
use result::Result;
use error::AnnotationErrorKind as AEK;
+use error::AnnotationError as AE;
use error::ResultExt;
pub trait Annotateable {
@@ -72,7 +72,7 @@ impl Annotateable for Entry {
.and_then(|res| match res {
Some(&Value::Boolean(b)) => Ok(b),
None => Ok(false),
- _ => Err(AEK::HeaderTypeError.into_error()),
+ _ => Err(AE::from_kind(AEK::HeaderTypeError)),
})
}
diff --git a/lib/entry/libimagentryannotation/src/annotation_fetcher.rs b/lib/entry/libimagentryannotation/src/annotation_fetcher.rs
index c49ce865..27f2f4b8 100644
--- a/lib/entry/libimagentryannotation/src/annotation_fetcher.rs
+++ b/lib/entry/libimagentryannotation/src/annotation_fetcher.rs
@@ -70,12 +70,12 @@ pub mod iter {
use toml_query::read::TomlValueReadExt;
- use libimagerror::into::IntoError;
use libimagnotes::note::Note;
use libimagnotes::note::NoteIterator;
use result::Result;
use error::AnnotationErrorKind as AEK;
+ use error::AnnotationError as AE;
use error::ResultExt;
#[derive(Debug)]
@@ -99,7 +99,7 @@ pub mod iter {
match note.get_header().read("annotation.is_annotation") {
Ok(None) => continue, // not an annotation
Ok(Some(&Value::Boolean(true))) => return Some(Ok(note)),
- Ok(Some(_)) => return Some(Err(AEK::HeaderTypeError.into_error())),
+ Ok(Some(_)) => return Some(Err(AE::from_kind(AEK::HeaderTypeError))),
Err(e) => return Some(Err(e).chain_err(|| AEK::HeaderReadError)),
}
},
diff --git a/lib/entry/libimagentryannotation/src/error.rs b/lib/entry/libimagentryannotation/src/error.rs
index 7543b85a..8a349b71 100644
--- a/lib/entry/libimagentryannotation/src/error.rs
+++ b/lib/entry/libimagentryannotation/src/error.rs
@@ -17,10 +17,6 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
-use std::error::Error;
-
-use libimagerror::into::IntoError;
-
error_chain! {
types {
AnnotationError, AnnotationErrorKind, ResultExt, Result;
@@ -60,14 +56,3 @@ error_chain! {
}
}
-impl IntoError for AnnotationErrorKind {
- type Target = AnnotationError;
-
- fn into_error(self) -> Self::Target {
- AnnotationError::from_kind(self)
- }
-
- fn into_error_with_cause(self, _: Box<Error>) -> Self::Target {
- AnnotationError::from_kind(self)
- }
-}