From 30ac77d62645a805dc3bff7569319cdedd7a93da Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 29 Apr 2018 10:18:59 +0200 Subject: Add error module --- lib/entry/libimagentryfilter/Cargo.toml | 1 + lib/entry/libimagentryfilter/src/error.rs | 34 +++++++++++++++++++++++++++++++ lib/entry/libimagentryfilter/src/lib.rs | 2 ++ 3 files changed, 37 insertions(+) create mode 100644 lib/entry/libimagentryfilter/src/error.rs (limited to 'lib/entry/libimagentryfilter') diff --git a/lib/entry/libimagentryfilter/Cargo.toml b/lib/entry/libimagentryfilter/Cargo.toml index b1e81f83..8cbc8e59 100644 --- a/lib/entry/libimagentryfilter/Cargo.toml +++ b/lib/entry/libimagentryfilter/Cargo.toml @@ -27,6 +27,7 @@ regex = "0.2" semver = "0.8" toml = "0.4" toml-query = "0.6" +error-chain = "0.11" libimagstore = { version = "0.8.0", path = "../../../lib/core/libimagstore" } libimagentrytag = { version = "0.8.0", path = "../../../lib/entry/libimagentrytag" } diff --git a/lib/entry/libimagentryfilter/src/error.rs b/lib/entry/libimagentryfilter/src/error.rs new file mode 100644 index 00000000..370b3fb9 --- /dev/null +++ b/lib/entry/libimagentryfilter/src/error.rs @@ -0,0 +1,34 @@ +// +// imag - the personal information management suite for the commandline +// Copyright (C) 2015-2018 Matthias Beyer and contributors +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; version +// 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// + +error_chain! { + + types { + FilterError, FilterErrorKind, ResultExt, Result; + } + + foreign_links { + TomlQueryError(::toml_query::error::Error); + } + + errors { + } + +} + diff --git a/lib/entry/libimagentryfilter/src/lib.rs b/lib/entry/libimagentryfilter/src/lib.rs index 68917fb2..b7870fe1 100644 --- a/lib/entry/libimagentryfilter/src/lib.rs +++ b/lib/entry/libimagentryfilter/src/lib.rs @@ -38,6 +38,7 @@ extern crate regex; extern crate semver; extern crate toml; extern crate toml_query; +#[macro_use] extern crate error_chain; extern crate libimagstore; extern crate libimagentrytag; @@ -46,6 +47,7 @@ extern crate libimagentrytag; // these depend only on libimagstore pub mod builtin; +pub mod error; // extended functionality of the crate // these depend on other internal libraries than libimagstore and use the upper core modules for -- cgit v1.2.3