]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
Elaborate the failing step when forwarding errors on return
authorSimon Rozman <simon@rozman.si>
Mon, 4 Mar 2019 13:08:13 +0000 (14:08 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 4 Mar 2019 15:37:11 +0000 (16:37 +0100)
Signed-off-by: Simon Rozman <simon@rozman.si>
tun/tun_windows.go

index d767d794ea035eff9e3b9d183624c28722a884dc..e2752dbc0057c1dd54aedee5190ffc26ae266454 100644 (file)
@@ -59,7 +59,7 @@ func CreateTUN(ifname string) (TUNDevice, error) {
                // Interface does not exist or an error occured. Create one.
                wt, _, err = wintun.CreateInterface("WireGuard Tunnel Adapter", 0)
                if err != nil {
-                       return nil, err
+                       return nil, errors.New("Creating Wintun adapter failed: " + err.Error())
                }
        } else if err != nil {
                // Foreign interface with the same name found.
@@ -72,13 +72,13 @@ func CreateTUN(ifname string) (TUNDevice, error) {
        err = wt.SetInterfaceName(ifname)
        if err != nil {
                wt.DeleteInterface(0)
-               return nil, err
+               return nil, errors.New("Setting interface name failed: " + err.Error())
        }
 
        err = wt.FlushInterface()
        if err != nil {
                wt.DeleteInterface(0)
-               return nil, err
+               return nil, errors.New("Flushing interface failed: " + err.Error())
        }
 
        signalNameUTF16, err := windows.UTF16PtrFromString(wt.SignalEventName())