imag/lib/entry/libimagentrylink/src/error.rs

104 lines
3.1 KiB
Rust
Raw Normal View History

//
// imag - the personal information management suite for the commandline
// Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> 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 {
LinkError, LinkErrorKind, ResultExt, Result;
}
errors {
EntryHeaderReadError {
description("Error while reading an entry header")
display("Error while reading an entry header")
}
EntryHeaderWriteError {
description("Error while writing an entry header")
display("Error while writing an entry header")
}
ExistingLinkTypeWrong {
description("Existing link entry has wrong type")
display("Existing link entry has wrong type")
}
LinkTargetDoesNotExist {
description("Link target does not exist in the store")
display("Link target does not exist in the store")
}
LinkParserError {
description("Link cannot be parsed")
display("Link cannot be parsed")
}
LinkParserFieldMissingError {
description("Link cannot be parsed: Field missing")
display("Link cannot be parsed: Field missing")
}
LinkParserFieldTypeError {
description("Link cannot be parsed: Field type wrong")
display("Link cannot be parsed: Field type wrong")
}
InternalConversionError {
description("Error while converting values internally")
display("Error while converting values internally")
}
InvalidUri {
description("URI is not valid")
display("URI is not valid")
}
StoreReadError {
description("Store read error")
display("Store read error")
}
StoreWriteError {
description("Store write error")
display("Store write error")
}
StoreIdError {
description("StoreId handling error")
display("StoreId handling error")
}
}
}
2016-02-03 14:47:14 +00:00
pub use self::error::LinkError;
pub use self::error::LinkErrorKind;
2016-08-03 09:22:57 +00:00
pub use self::error::MapErrInto;
2017-09-03 11:53:55 +00:00
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)
}
}