summaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-10-28 20:51:04 +0100
committerMarkus Unterwaditzer <markus@unterwaditzer.net>2018-10-28 20:51:04 +0100
commit2163caa2e1cf409d3bc8d0b4c010bc1bdedf1998 (patch)
tree3064c868107a45a5640200b52d63a4efd4aa286c /src/error.rs
parentf100677f3022e68c634c3c19e0b88ed7578aec27 (diff)
Update dependency: error-chain (#26)
* Update dependency: error-chain * Replace dependency: error_chain -> failure * fixup! Replace dependency: error_chain -> failure * Use enum for errors (in return types) * fixup! Use enum for errors (in return types)
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/error.rs b/src/error.rs
index 22e64a8..20654df 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -1,30 +1,16 @@
+#[derive(Debug, Clone, Eq, PartialEq, Fail)]
+pub enum VObjectErrorKind {
+ #[fail(display = "Parser error: {}", _0)]
+ ParserError(String),
-error_chain! {
-
- types {
- VObjectError, VObjectErrorKind, ResultExt, Result;
- }
-
- foreign_links {
- ChronoParseError(::chrono::format::ParseError) #[cfg(feature = "timeconversions")];
- }
-
- errors {
- ParserError(desc: String) {
- description("Parser error")
- display("{}", desc)
- }
-
- NotAVCard {
- description("Input is not a valid VCard")
- display("Passed content string is not a VCard")
- }
-
- NotAnICalendar(content: String) {
- description("Input is not a valid ICalendar")
- display("Not an ICalendar: '{}'", content)
- }
- }
+ #[fail(display = "Not a Vcard")]
+ NotAVCard,
+ #[fail(display = "Not a Icalendar: {}", _0)]
+ NotAnICalendar(String),
+ #[fail(display = "{}", _0)]
+ ChronoError(::chrono::format::ParseError),
}
+
+pub type Result<T> = ::std::result::Result<T, VObjectErrorKind>;