all: Tweak error creation (#6391)

- In the few places where we wrap errors, use the new Go 1.13 "%w"
  construction instead of %s or %v.

- Where we create errors with constant strings, consistently use
  errors.New and not fmt.Errorf.

- Remove capitalization from errors in the few places where we had that.
This commit is contained in:
Jakob Borg
2020-03-03 22:40:00 +01:00
committed by GitHub
parent eddc8d3ff2
commit dd92b2b8f4
30 changed files with 67 additions and 60 deletions
+2 -2
View File
@@ -345,7 +345,7 @@ func (m *model) startFolderLocked(cfg config.FolderConfiguration) {
var err error
ver, err = versioner.New(ffs, cfg.Versioning)
if err != nil {
panic(fmt.Errorf("creating versioner: %v", err))
panic(fmt.Errorf("creating versioner: %w", err))
}
if service, ok := ver.(suture.Service); ok {
// The versioner implements the suture.Service interface, so
@@ -1688,7 +1688,7 @@ func (m *model) GetIgnores(folder string) ([]string, []string, error) {
if !cfgOk {
cfg, cfgOk = m.cfg.Folders()[folder]
if !cfgOk {
return nil, nil, fmt.Errorf("Folder %s does not exist", folder)
return nil, nil, fmt.Errorf("folder %s does not exist", folder)
}
}