all: Replace errors.Cause with errors.Is (#8236)
This commit is contained in:
@@ -882,7 +882,7 @@ func (s *connectionStatusHandler) ConnectionStatus() map[string]ConnectionStatus
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *connectionStatusHandler) setConnectionStatus(address string, err error) {
|
func (s *connectionStatusHandler) setConnectionStatus(address string, err error) {
|
||||||
if errors.Cause(err) == context.Canceled {
|
if errors.Is(err, context.Canceled) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1849,7 +1849,7 @@ func (f *sendReceiveFolder) moveForConflict(name, lastModBy string, scanChan cha
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *sendReceiveFolder) newPullError(path string, err error) {
|
func (f *sendReceiveFolder) newPullError(path string, err error) {
|
||||||
if errors.Cause(err) == f.ctx.Err() {
|
if errors.Is(err, f.ctx.Err()) {
|
||||||
// Error because the folder stopped - no point logging/tracking
|
// Error because the folder stopped - no point logging/tracking
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -8,14 +8,14 @@ package pmp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/jackpal/gateway"
|
"github.com/jackpal/gateway"
|
||||||
"github.com/jackpal/go-nat-pmp"
|
natpmp "github.com/jackpal/go-nat-pmp"
|
||||||
"github.com/pkg/errors"
|
|
||||||
|
|
||||||
"github.com/syncthing/syncthing/lib/nat"
|
"github.com/syncthing/syncthing/lib/nat"
|
||||||
"github.com/syncthing/syncthing/lib/util"
|
"github.com/syncthing/syncthing/lib/util"
|
||||||
@@ -50,7 +50,7 @@ func Discover(ctx context.Context, renewal, timeout time.Duration) []nat.Device
|
|||||||
return ierr
|
return ierr
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Cause(err) == context.Canceled {
|
if errors.Is(err, context.Canceled) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if strings.Contains(err.Error(), "Timed out") {
|
if strings.Contains(err.Error(), "Timed out") {
|
||||||
|
|||||||
+1
-1
@@ -212,7 +212,7 @@ loop:
|
|||||||
case *UnsupportedDeviceTypeError:
|
case *UnsupportedDeviceTypeError:
|
||||||
l.Debugln(err.Error())
|
l.Debugln(err.Error())
|
||||||
default:
|
default:
|
||||||
if errors.Cause(err) != context.Canceled {
|
if !errors.Is(err, context.Canceled) {
|
||||||
l.Infoln("UPnP parse:", err)
|
l.Infoln("UPnP parse:", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user