Add more descriptive errors for debugging
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
IamTheFij 2022-11-03 15:16:37 -07:00
parent a92ebc69ca
commit 8b5d15d4b2
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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