lib: Wrap errors with errors.Wrap instead of fmt.Errorf (#6181)

This commit is contained in:
Simon Frei
2019-11-23 16:20:54 +01:00
committed by Audrius Butkevicius
parent e2f6d0d6c4
commit cf312abc72
7 changed files with 51 additions and 43 deletions

View File

@@ -10,7 +10,6 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"net"
"path/filepath"
@@ -21,6 +20,9 @@ import (
stdsync "sync"
"time"
"github.com/pkg/errors"
"github.com/thejerf/suture"
"github.com/syncthing/syncthing/lib/config"
"github.com/syncthing/syncthing/lib/connections"
"github.com/syncthing/syncthing/lib/db"
@@ -35,7 +37,6 @@ import (
"github.com/syncthing/syncthing/lib/upgrade"
"github.com/syncthing/syncthing/lib/util"
"github.com/syncthing/syncthing/lib/versioner"
"github.com/thejerf/suture"
)
// How many files to send in each Index/IndexUpdate message.
@@ -1799,7 +1800,7 @@ func (m *model) SetIgnores(folder string, content []string) error {
err := cfg.CheckPath()
if err == config.ErrPathMissing {
if err = cfg.CreateRoot(); err != nil {
return fmt.Errorf("failed to create folder root: %v", err)
return errors.Wrap(err, "failed to create folder root")
}
err = cfg.CheckPath()
}