]> code.octet-stream.net Git - netwatcher/commitdiff
Improve Windows errors
authorThomas Karpiniec <tom.karpiniec@outlook.com>
Fri, 28 Jun 2024 01:13:40 +0000 (11:13 +1000)
committerThomas Karpiniec <tom.karpiniec@outlook.com>
Fri, 28 Jun 2024 01:13:40 +0000 (11:13 +1000)
src/watch_win.rs

index 3a4a30142186c069af59b270a83458ec937e8c79..a247916b7aac1cf586f54d54a1526e1ad11cccdb 100644 (file)
@@ -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)),
     }
 }