hipcheck_common/
error.rs

1// SPDX-License-Identifier: Apache-2.0
2
3/// An enumeration of errors that can occur in a Hipcheck plugin
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6	/// An unknown error occurred, the query is in an unspecified state
7	#[error("unknown error; query is in an unspecified state")]
8	UnspecifiedQueryState,
9
10	/// The `PluginEngine` received a message with the unexpected status `ReplyInProgress`
11	#[error("unexpected ReplyInProgress state for query")]
12	UnexpectedReplyInProgress,
13
14	/// The `PluginEngine` received a message with the unexpected status `RequestInProgress`
15	#[error("unexpected RequestInProgress state for query")]
16	UnexpectedRequestInProgress,
17
18	/// The `PluginEngine` received a message with a request-type status when it expected a reply
19	#[error("remote sent QuerySubmit when reply chunk expected")]
20	ReceivedSubmitWhenExpectingReplyChunk,
21
22	/// The `PluginEngine` received a message with a reply-type status when it expected a submit
23	#[error("remote sent QueryReply when submit chunk expected")]
24	ReceivedReplyWhenExpectingSubmitChunk,
25
26	/// The `PluginEngine` received additional messages when it did not expect any
27	#[error("received additional message for ID '{id}' after query completion")]
28	MoreAfterQueryComplete { id: usize },
29
30	#[error("invalid JSON in query key")]
31	InvalidJsonInQueryKey(#[source] serde_json::Error),
32
33	#[error("invalid JSON in query output")]
34	InvalidJsonInQueryOutput(#[source] serde_json::Error),
35}