toy_arms/external/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum TAExternalError {
5 #[error("Snapshot was failed for some reason. To see the detail, destructure the inner error enum.")]
6 SnapshotFailed(SnapshotFailedDetail),
7 #[error("Specified process was not found. Make sure the process is running and the name is correct.")]
8 ProcessNotFound,
9 #[error("Specified module was not found in the process. Make sure the name is correct.")]
10 ModuleNotFound,
11 #[error("read failed for some reason. To see the detail, destructure the inner error enum.")]
12 ReadMemoryFailed(ReadWriteMemoryFailedDetail),
13 #[error("write failed for some reason. To see the detail, destructure the inner error enum.")]
14 WriteMemoryFailed(ReadWriteMemoryFailedDetail),
15}
16
17#[derive(Debug, Error)]
18pub enum ReadWriteMemoryFailedDetail {
19 #[error("Attempt to access invalid address")]
20 ErrorInvalidAddress,
21 #[error("Only part of a ReadProcessMemory or WriteProcessMemory request was completed. The page might be protected.")]
22 ErrorPartialCopy,
23 #[error("The given handle is invalid.")]
24 ErrorInvalidHandle,
25 #[error("Error code {} is not supported by this library", error_code)]
26 UnknownError{ error_code: u32 },
27}
28
29#[derive(Debug, Error)]
30pub enum SnapshotFailedDetail {
31 #[error("Invalid handle has been retrieved from CreateToolhelp32Snapshot")]
32 InvalidHandle,
33 #[error("No more files exist in the given snap by CreateToolhelp32Snapshot")]
34 NoMoreFiles,
35}