lib/versioner: Improve error messages (fixes #7354) (#7357)

This commit is contained in:
Simon Frei
2021-02-17 11:17:44 +01:00
committed by Jakob Borg
parent 9be07de7c6
commit f5590c3345
7 changed files with 58 additions and 13 deletions
+2 -1
View File
@@ -26,6 +26,7 @@ import (
"testing"
"time"
"github.com/pkg/errors"
"github.com/syncthing/syncthing/lib/config"
"github.com/syncthing/syncthing/lib/db"
"github.com/syncthing/syncthing/lib/db/backend"
@@ -2859,7 +2860,7 @@ func TestVersionRestore(t *testing.T) {
ferr, err := m.RestoreFolderVersions("default", restore)
must(t, err)
if err, ok := ferr["something"]; len(ferr) > 1 || !ok || err != "cannot restore on top of a directory" {
if err, ok := ferr["something"]; len(ferr) > 1 || !ok || !errors.Is(err, versioner.ErrDirectory) {
t.Fatalf("incorrect error or count: %d %s", len(ferr), ferr)
}