From a26e228658fabc4495f3d671850903c8e105d9a1 Mon Sep 17 00:00:00 2001
From: Thomas Karpiniec <tom.karpiniec@outlook.com>
Date: Fri, 28 Jun 2024 11:13:40 +1000
Subject: [PATCH] Improve Windows errors

---
 src/watch_win.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/watch_win.rs b/src/watch_win.rs
index 3a4a301..a247916 100644
--- a/src/watch_win.rs
+++ b/src/watch_win.rs
@@ -65,10 +65,10 @@ pub(crate) fn watch_interfaces<F: FnMut(Update) + Send + 'static>(
             // Then return the handle
             Ok(WatchHandle { hnd, _state: state })
         }
-        ERROR_INVALID_HANDLE => Err(Error::Internal),
-        ERROR_INVALID_PARAMETER => Err(Error::Internal),
-        ERROR_NOT_ENOUGH_MEMORY => Err(Error::Internal),
-        _ => Err(Error::Internal), // TODO: Use FormatMessage and get real error
+        ERROR_INVALID_HANDLE => Err(Error::InvalidHandle),
+        ERROR_INVALID_PARAMETER => Err(Error::InvalidParameter),
+        ERROR_NOT_ENOUGH_MEMORY => Err(Error::NotEnoughMemory),
+        _ => Err(Error::UnexpectedWindowsResult(res.0)),
     }
 }
 
-- 
2.39.5