task_hookrs/error.rs
1//
2// This Source Code Form is subject to the terms of the Mozilla Public
3// License, v. 2.0. If a copy of the MPL was not distributed with this
4// file, You can obtain one at http://mozilla.org/MPL/2.0/.
5//
6
7//! Definitions for error handling with failure
8
9/// Failure error kind type, defining error messages
10#[derive(Debug, thiserror::Error)]
11pub enum Error {
12 /// Error kind indicating that the JSON parser failed
13 #[error("Failed to create a Task from JSON")]
14 ParserError,
15
16 /// Error kind indicating that the Reader failed to read something
17 #[error("Failed to read tasks from a Reader")]
18 ReaderError,
19
20 /// Error kind indicating that a call to the task warrior binary failed
21 #[error("There was a problem while calling the external 'task' binary")]
22 TaskCmdError,
23
24 /// Error kind indicating that a conversion to JSON failed
25 #[error("A Task could not be converted to JSON")]
26 SerializeError,
27
28 /// Error wrapper for std::io::Error
29 #[error(transparent)]
30 Io(#[from] std::io::Error),
31
32 /// Error wrapper for serde_json::Error
33 #[error(transparent)]
34 SerdeJson(#[from] serde_json::Error),
35}