summaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-10-29 21:46:03 +0100
committerMatthias Beyer <mail@beyermatthias.de>2018-11-09 10:14:51 +0100
commit29e713c6efe55602922e0a7986b950afbd0a5500 (patch)
treecf19152fd05c0883b93e753d80ad9e230608044b /src/error.rs
parent15c4de5e0ff12535bb7de6df8dfdc88bd9727762 (diff)
Move error handling to failure
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/error.rs b/src/error.rs
index a936736..2ed9bd5 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -4,24 +4,26 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
-//! Error module, containing error types
-error_chain!{
- errors {
- /// Error kind indicating that the JSON parser failed
- ParserError {
- description("Failed to create a Task from JSON")
- }
- /// Error kind indicating that the Reader failed to read something
- ReaderError {
- description("Failed to read tasks from a Reader")
- }
- /// Error kind indicating that a call to the task warrior binary failed
- TaskCmdError {
- description("There was a problem while calling the external 'task' binary")
- }
- /// Error kind indicating that a conversion to JSON failed
- SerializeError {
- description("A Task could not be converted to JSON")
- }
- }
+//! Definitions for error handling with failure
+
+/// Failure error kind type, defining error messages
+#[derive(Debug, Clone, Eq, PartialEq, Fail)]
+pub enum ErrorKind {
+
+ /// Error kind indicating that the JSON parser failed
+ #[fail(display = "Failed to create a Task from JSON")]
+ ParserError,
+
+ /// Error kind indicating that the Reader failed to read something
+ #[fail(display = "Failed to read tasks from a Reader")]
+ ReaderError,
+
+ /// Error kind indicating that a call to the task warrior binary failed
+ #[fail(display = "There was a problem while calling the external 'task' binary")]
+ TaskCmdError,
+
+ /// Error kind indicating that a conversion to JSON failed
+ #[fail(display = "A Task could not be converted to JSON")]
+ SerializeError
}
+