archiver: Add filepath to error message if it is not included yet

This commit is contained in:
Michael Eischer 2024-01-06 19:08:24 +01:00
parent e886c3f6b2
commit 1bab29c336
1 changed files with 6 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import (
"path"
"runtime"
"sort"
"strings"
"time"
"github.com/restic/restic/internal/debug"
@ -169,6 +170,11 @@ func (arch *Archiver) error(item string, err error) error {
return err
}
// not all errors include the filepath, thus add it if it is missing
if !strings.Contains(err.Error(), item) {
err = fmt.Errorf("%v: %w", item, err)
}
errf := arch.Error(item, err)
if err != errf {
debug.Log("item %v: error was filtered by handler, before: %q, after: %v", item, err, errf)