X-Git-Url: https://code.octet-stream.net/netwatcher/blobdiff_plain/422be212d60fe053ed9bcb14aad6d1059b3a2906..487dfaa43e0370e63157dc302d55543cff2949cf:/src/error.rs?ds=sidebyside diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..bb099cc --- /dev/null +++ b/src/error.rs @@ -0,0 +1,24 @@ +/// Errors in netwatcher or in one of the underlying platform integratinos. +#[derive(Debug, Clone, PartialEq, Eq)] +#[non_exhaustive] +pub enum Error { + CreateSocket(String), + Bind(String), + CreatePipe(String), + Getifaddrs(String), + GetInterfaceName(String), + FormatMacAddress, + UnexpectedWindowsResult(u32), + AddressNotAssociated, + InvalidParameter, + NotEnoughMemory, + InvalidHandle, +} + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}", self) + } +} + +impl std::error::Error for Error {}