Skip to main content

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")]
8	UnspecifiedQueryState,
9
10	#[error("the query is not supported for the target")]
11	QueryUnsupportedForTarget,
12
13	/// The `PluginEngine` received a message with the unexpected status `ReplyInProgress`
14	#[error("unexpected ReplyInProgress state for query")]
15	UnexpectedReplyInProgress,
16
17	/// The `PluginEngine` received a message with the unexpected status `RequestInProgress`
18	#[error("unexpected RequestInProgress state for query")]
19	UnexpectedRequestInProgress,
20
21	/// The `PluginEngine` received a message with a request-type status when it expected a reply
22	#[error("remote sent QuerySubmit when reply chunk expected")]
23	ReceivedSubmitWhenExpectingReplyChunk,
24
25	/// The `PluginEngine` received a message with a reply-type status when it expected a submit
26	#[error("remote sent QueryReply when submit chunk expected")]
27	ReceivedReplyWhenExpectingSubmitChunk,
28
29	/// The `PluginEngine` received additional messages when it did not expect any
30	#[error("received additional message for ID '{id}' after query completion")]
31	MoreAfterQueryComplete { id: usize },
32
33	#[error("invalid JSON in query key")]
34	InvalidJsonInQueryKey(#[source] serde_json::Error),
35
36	#[error("invalid JSON in query output")]
37	InvalidJsonInQueryOutput(#[source] serde_json::Error),
38}