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

This commit is contained in:
Simon Frei
2021-02-12 20:30:51 +01:00
committed by GitHub
parent 5e9c7bc022
commit 7e4e2f3720
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)
}