From 8b5d15d4b212c05ca386fc7db7bed62a3a4680f5 Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Thu, 3 Nov 2022 15:16:37 -0700 Subject: [PATCH] Add more descriptive errors for debugging --- restic.go | 2 +- restic_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/restic.go b/restic.go index fcb2829..d95599f 100644 --- a/restic.go +++ b/restic.go @@ -344,7 +344,7 @@ func (rcmd Restic) ReadSnapshots() ([]Snapshot, error) { snapshots := new([]Snapshot) if err = json.Unmarshal([]byte(lines[0]), snapshots); err != nil { - return nil, fmt.Errorf("failed parsing snapshot results: %w", err) + return nil, fmt.Errorf("failed parsing snapshot results from %s: %w", lines[0], err) } return *snapshots, nil diff --git a/restic_test.go b/restic_test.go index 40ccda4..350dc00 100644 --- a/restic_test.go +++ b/restic_test.go @@ -220,7 +220,7 @@ func TestResticInterface(t *testing.T) { // Make sure no existing repo is found _, err = restic.ReadSnapshots() if err == nil || !errors.Is(err, main.ErrRepoNotFound) { - AssertEqualFail(t, "didn't get expected error for backup", main.ErrRepoNotFound, err) + AssertEqualFail(t, "didn't get expected error for backup", main.ErrRepoNotFound.Error(), err.Error()) } // Try to backup when repo is not initialized