summaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
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>;