Add the derive proc macro

This commit is contained in:
Mihai Dinculescu
2022-10-10 19:33:49 +01:00
parent 2f845f1c8f
commit 9b7e3b97db
29 changed files with 951 additions and 96 deletions

View File

@@ -1,15 +1,24 @@
use thiserror::Error;
/// SimConnect SDK error.
#[derive(Error, Debug)]
pub enum SimConnectError {
/// SimConnect error.
#[error("SimConnect error: {0}")]
SimConnectError(i32),
#[error("SimConnect unrecognized: {0}")]
/// SimConnect unrecognized error. Occurs when an unimplemented event is received by the SDK.
SimConnectUnrecognizedEvent(u32),
/// Object already registered with the client instance.
#[error("Object `{0}` has already been registered")]
ObjectAlreadyRegistered(String),
/// Object mismatch.
#[error("Tried to convert object of type {actual} to {expected}")]
ObjectMismatch { actual: String, expected: String },
/// Conversation error.
#[error("Conversion error: {0}")]
ConversionError(#[from] std::num::TryFromIntError),
/// Unexpected error.
#[error("Unexpected error: {0}")]
UnexpectedError(String),
}