chore(rust/windows): more detailed error log for wintun::Adapter::create (#6596)

Without this we don't log the `std::io::ErrorKind`, which is useful to
know.

Refs #6547
This commit is contained in:
Reactor Scram
2024-09-04 21:43:25 -05:00
committed by GitHub
parent 8f4d1eaac1
commit df3067a8f8

View File

@@ -226,7 +226,13 @@ impl Tun {
let uuid = uuid::Uuid::from_str(TUNNEL_UUID)
.expect("static UUID should always parse correctly")
.as_u128();
let adapter = &Adapter::create(&wintun, TUNNEL_NAME, TUNNEL_NAME, Some(uuid))?;
let adapter = match Adapter::create(&wintun, TUNNEL_NAME, TUNNEL_NAME, Some(uuid)) {
Ok(x) => x,
Err(error) => {
tracing::error!(?error, "Failed in `Adapter::create`");
return Err(error)?;
}
};
let iface_idx = adapter.get_adapter_index()?;
set_iface_config(adapter.get_luid(), mtu)?;