1#[derive(thiserror::Error, Debug)]
4pub enum Error {
6 #[error("Missing key for argument {argument}")]
7 MissingArgKey {
9 argument: String,
11 },
12 #[error("Missing value for argument {argument}")]
13 MissingArgValue {
15 argument: String,
17 },
18 #[error("Invalid boolean value {name} ({val})")]
19 InvalidBool {
21 name: String,
23 val: String,
25 },
26 #[error(
27 "Setting the QEMU plugin uninstall callback was attempted concurrently and this attempt failed."
28 )]
29 ConcurrentPluginUninstallCallbackSet,
31 #[error(
32 "Setting the QEMU plugin reset callback was attempted concurrently and this attempt failed."
33 )]
34 ConcurrentPluginResetCallbackSet,
36 #[error("Invalid state for plugin reset callback")]
37 PluginResetCallbackState,
39 #[error("Invalid instruction index {index} for translation block of size {size}")]
40 InvalidInstructionIndex {
42 index: usize,
44 size: usize,
46 },
47 #[error("No disassembly string available for instruction")]
48 NoDisassemblyString,
50 #[error("Invalid size {size} for read of register {name}")]
51 InvalidRegisterReadSize {
53 name: String,
55 size: usize,
57 },
58 #[error("Error while reading register {name}")]
59 RegisterReadError {
61 name: String,
63 },
64 #[error("Error while writing register {name}")]
65 RegisterWriteError {
67 name: String,
69 },
70 #[cfg(not(any(
71 feature = "plugin-api-v0",
72 feature = "plugin-api-v1",
73 feature = "plugin-api-v2",
74 feature = "plugin-api-v3"
75 )))]
76 #[error("Error while reading {len} bytes from virtual address {addr:#x}")]
77 VaddrReadError {
79 addr: u64,
81 len: u32,
83 },
84 #[cfg(not(any(
85 feature = "plugin-api-v0",
86 feature = "plugin-api-v1",
87 feature = "plugin-api-v2",
88 feature = "plugin-api-v3",
89 feature = "plugin-api-v4"
90 )))]
91 #[error("Error while writing {len} bytes to virtual address {addr:#x}")]
92 VaddrWriteError {
94 addr: u64,
96 len: u32,
98 },
99 #[cfg(not(any(
100 feature = "plugin-api-v0",
101 feature = "plugin-api-v1",
102 feature = "plugin-api-v2",
103 feature = "plugin-api-v3",
104 feature = "plugin-api-v4"
105 )))]
106 #[error("Error while reading {len} bytes from hardware address {addr:#x}: {result}")]
107 HwaddrReadError {
109 addr: u64,
111 len: u32,
113 result: crate::HwaddrOperationResult,
115 },
116 #[cfg(not(any(
117 feature = "plugin-api-v0",
118 feature = "plugin-api-v1",
119 feature = "plugin-api-v2",
120 feature = "plugin-api-v3",
121 feature = "plugin-api-v4"
122 )))]
123 #[error("Error while writing {len} bytes to hardware address {addr:#x}: {result}")]
124 HwaddrWriteError {
126 addr: u64,
128 len: u32,
130 result: crate::HwaddrOperationResult,
132 },
133 #[cfg(not(any(
134 feature = "plugin-api-v0",
135 feature = "plugin-api-v1",
136 feature = "plugin-api-v2",
137 feature = "plugin-api-v3",
138 feature = "plugin-api-v4"
139 )))]
140 #[error("Error while translating virtual address {vaddr:#x} to hardware address")]
141 VaddrTranslateError {
143 vaddr: u64,
145 },
146 #[error(transparent)]
147 Utf8Error(#[from] std::str::Utf8Error),
149 #[error(transparent)]
150 NulError(#[from] std::ffi::NulError),
152 #[error(transparent)]
153 Other(#[from] anyhow::Error),
155}
156
157pub type Result<T> = std::result::Result<T, Error>;